I am using JME 3.0beta and I can’t tell if there is a bug in the CapsuleCollisionShape or I am doing something wrong. Creating the shape seems simple enough, yet I am not getting the shape I expect. Looking at other screenshots and reading about what it is doing I expect to see the top half a sphere on top of a cylinder with the bottom half of the sphere under the cylinder.

But from this screenshot it appears that the complete sphere sits on the top of the cylinder:

Not sure how helpful the code I have for creating the CapsuleCollisionShape will be, but here it is anyways:

[java] private void updateHitBox() {

CapsuleCollisionShape capsule = new CapsuleCollisionShape( m_hitBoxRadius, m_hitBoxHeight, 1 );

//SphereCollisionShape capsule = new SphereCollisionShape( m_hitBoxRadius );

if( m_control == null ) {

m_control = new CharacterControl( capsule, m_hitBoxStep );

m_node.addControl( m_control );

} else {

m_control.setCollisionShape( capsule );





Your mesh is probably off-center. The RigidBody will move the attached spatial to its center.

So if I move the Spatial and attach it to a Node and then attach a CharacterControl to the Node the CollisionShape will not appear correctly when I view the CollisionShapes’ mesh?

If I change my code to use a SphereCollisionShape I see the bottom of the sphere touching the ground, but with a capsule I don’t.

yep, the spatial is moved in place in world coordinates, no matter what the parent location is. you can attach the RigidBodyControl to the parent node though and move the child spatial.

Thanks for you help, I do appreciate it, but either I’m not explaining my problem or I’m not following you at all :slight_smile:

The only thing I’m having a problem with is the shape of the CollisionShape, not my Spatial at all.

Let say I have no Spatial at all, say I attached a CharacterControl made using a CapsuleCollisionShape to an empty Node, and place it on a horizontal plane. If I am viewing the meshs of the Controls/Shapes, shouldn’t I see the bottom half a sphere making contact with the plane? I do when I use a SphereCollisionShape. Looking at my screenshot and ignoring the model but instead just looking at the blue wire frame mesh I see a complete sphere on top of the cylinder.

The center of your Spatial is where the center of the collision shape is. The mesh (the visible “mine”) is below that center. Move it up in blender or whatever 3d editor you use or attach the Spatial to a Node and move it up so its visual center is where the Node center is, then attach the RigidBody to that.

Never mind, I’m on crack :wink: it was the camera angle. As the object moves away from the center of the screen I can see the shape is what it should be.