Get collision of CharacterControl


is it somehow possible to be notified when a CharacterControl collides with something? If so, how?

Yes, like any other collision in physics, check the wiki or press F1 and enter “collision” in the help.

Ok, so I am extending CharacterControl and implementing PhysicsCollisionListener. If one such custom control object collides, will the event object hold this custom control object (and the other one it collided with)?

Or the spatial my custom control is attached to?



public class ListeningCharacterControl extends CharacterControl implements PhysicsCollisionListener {

public ListeningCharacterControl(CollisionShape collisionShape, float f) {

super(collisionShape, f);



public void collision(PhysicsCollisionEvent event) {

System.out.println(“I’m here”);




This is my PhysicsListener. Now I add an instance of that to my spatial as control. Then I move it, when keyboard input happens (with setWalkDirection). It collides with the scene well (a RigidBodyControl), but the println doesn’t happen.

What’s the problem?

I guess you forgot physicsSpace.addCollisionListener(myListeningCharacterControl);

Any way to filter out collisions that happen because of gravity?

I want to play a sound when the player collides with any scene object except the ground.

No, gravity is a force like every other so its not discernible if something falls because of gravity or not.

So I cannot find out if I collided with the ground, when everything is part of one scene with one control?

Yes you can, just check if the thing you collided with is the floor…

I have a plane and a house. I attach them both to the same root node and then add the RigidBodyControl to the root node.

When I collide, the name of the character’s collision partner is always “null”.

So, set a name other than null to the spatial you attach the control to.