I attempted to create a second ghostControl to follow the player and record collisions, but this doesn’t seem to be working quite right.
No matter where I moved the player, the ghostcontrol would read off 2 collisions; 1 with the character control, which makes sense, and 1 with the RigidBodyControl (which I believe is referring to the scene) which doesn’t make too much sense. the strange part is, it would print a collision with the RigidBodyControl even if the player was in-midair. however, it did not print a collision with the RigidBodyControl when the player jumped past the highest roof in the scene, or stepped off of the edge of the scene. Do GhostControl Objects only check for collisions with bounding boxes, because that certianly seems to be what is going on. here is the code I used:
in the simpleInitApp() method:
ghostFloorCollisions = new GhostControl(capsuleShape);
bulletAppState.getPhysicsSpace().add(ghostFloorCollisions);
in the simpleUpdate() method:
ghostFloorCollisions.setPhysicsLocation(player.getPhysicsLocation().addLocal(new Vector3f(0,0,0)));
List objOverlappingObjects = ghostFloorCollisions.getOverlappingObjects();
int numOverlappingObjects = objOverlappingObjects.size();
if (numOverlappingObjects > 0) {
System.out.println(“COLLISIONS: “+Integer.toString(numOverlappingObjects));
System.out.println(objOverlappingObjects);
}