This is my player control i am coding
That is a RigidBody with the small cube a Ghost Control to detect if the player is on the ground or not.
The problem i am having is that the ghost Control reports a collision with the scene, if it is anywhere within the maximum bounds of the scene:
So anywhere in that red cube the ghost reports collision with the scene.
What the code looks like:
[java]
CollisionShape playerShape = new CapsuleCollisionShape(0.7f, 1.6f);
player = new RigidBodyControl(playerShape, 50);
CollisionShape cuboid = new BoxCollisionShape(cuboidSize);
onGroundTest = new GhostControl(cuboid);
player.setCollisionGroup(RigidBodyControl.COLLISION_GROUP_02);
player.setCollideWithGroups(RigidBodyControl.COLLISION_GROUP_01);
onGroundTest.setCollisionGroup(RigidBodyControl.COLLISION_GROUP_02);
onGroundTest.setCollideWithGroups(RigidBodyControl.COLLISION_GROUP_01);
[/java]
I change collision groups so the ghost wont report collisions with the player RigidBody
These are then added to the scene.
I think the problem lies with how i initialise the scene:
[java] float scale = 10;
Spatial scene = app.getAssetManager().loadModel("Scenes/test.j3o");
scene.scale(scale);
sceneNode.attachChild(scene);
RigidBodyControl sceneCollision = new RigidBodyControl(CollisionShapeFactory.createMeshShape(scene) , 0);
app.getBullet().getPhysicsSpace().add(sceneCollision);
sceneNode.addControl(sceneCollision);
app.getRootNode().attachChild(sceneNode);
app.getBullet().getPhysicsSpace().enableDebug(app.getAssetManager());[/java]
If this is the case, how could i initialise the scene for correct ghost collision reports?
Thanks.