[Bug] CapsuleCollisionShape Axis doesn't match the wireframe or collision

For some reason if I set the gravity before I set the physics location it fixes the problem.

player.setGravity(new Vector3f(0,-30f,0));
player.setPhysicsLocation(new Vector3f(0, 10, 0));

Ok, lets start with this. Please follow instructions when asked to clarify something, especially when its an engine leader.

CapsuleCollisionShape(1.5f, 18f, 1);

https://imgur.com/a/oHz0OD8

CapsuleCollisionShape(1.5f, 18f, 0);

Imgur

I am unclear exactly what your talking about but I think it may be that the capsule does not fall to the ground when changing the orientation from Y (1) to X (0)?

What has happened is I made an edit to the wiki about gravity and BetterCharacterControl, where gravity must be set AFTER adding the object to the physcicsspace, and I assumed it meant the same for CharacterControl.

Evidently it doesn’t. With CharacterControl, gravity works if you set it before or after adding to the physics space BUT gravity must be set BEFORE moving the physics location.

I fixed the example like so.

You can set the gravity before or after adding the object to the physics space, but gravity must be set BEFORE moving the physics space itself.

Anyone see a problem with this statement?

I think you mean physics location, and not physics space?

Err yep, oops.

Thanks.

1 Like

That looks like the issue, if I swap the order of those two methods in my test, I get the strange flipped results.

1 Like

Thank you @mitm for updating the documentation. Problem solved so far.

I love JMonkey!

1 Like