CharacterControl collision detection help

Hi! I have a CharacterControl that uses a CapsuleCollisionShape… I can’t seem to get it to register a collision in my PhysicsCollisionEvent. Every other physics object in the scene shows up in my debug except the CharacterControl.

This is my PhysicsCollisionEvent, the player control never shows up in the logger:

[java]public void collision(PhysicsCollisionEvent event) {
if(event.getNodeA().getName() != null) {
logger.log(Level.INFO, event.getNodeA().getName());
}
if(event.getNodeB().getName() != null) {
logger.log(Level.INFO, event.getNodeB().getName());
}
}[/java]

This is my player creation:

[java]CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1.5f, 3f, 1);
player = new CharacterControl(capsuleShape, 0.04f);
player.setJumpSpeed(10);
player.setFallSpeed(30);
player.setGravity(50);
player.setPhysicsLocation(new Vector3f(30, 4, 0));
getPhysicsSpace().add(player);[/java]

Thank you!

Did you add the character to a Node, and give the Node a name?

1 Like

Hi! I tried that, but I’m having issues due to my lack of knowledge… I’ve tried adding the CharacterControl to a Node but it doesn’t accept it because it’s not a Spatial. Do you have any insight into that? Thanks again! :slight_smile:

@wezrule said: Did you add the character to a Node, and give the Node a name?

Thank you! I figured it out. I was creating my Node improperly. Thanks!

@wezrule said: Did you add the character to a Node, and give the Node a name?