Walking around on a moving platform

I am adapting the “Hello Collisions” example into a game where the “terrain” is not wholly static but is the Geometry of a ship model.

The ship will roll, yaw and pitch as well as move through the world. I’m willing to accept the simplification for now that the gravity vector will always point to the ship’s keel, provided that the player’s position follow the ship’s deck as it rotates and translates through the world.

Is it sufficient to use the “Hello Collisions” code pretty much as-is, but rather than adding the player to the rootNode, adding him instead to the ship’s node? I’d hope that this would basically work although perhaps with the approximation that gravity would always point down the ship’s local Y vector.


Sadly, some testing seems to show that this cannot work.

It works if my ship stays at the origin, or quite near it, but it appears that its collision shape remains at the origin, despite being drawn in the correct place with Bullet debug mode on.

Here is the gist of what I am doing. If you see that something slightly different may work, let me know.

On my player:

CapsuleCollisionShape shape = new CapsuleCollisionShape(radius, standingOverallHeight - (2f * radius), PhysicsSpace.AXIS_Y); // radius, height, Y up

mBulletCharacterControl = new CharacterControl(shape, stepHeight);

mBulletCharacterControl.setApplyPhysicsLocal(true); // we may be on board a ship – is this right?

mBulletCharacterControl.setJumpSpeed(Physics.mph(20f) * getBulletAccuracy());

mBulletCharacterControl.setFallSpeed(Physics.mph(150f) * getBulletAccuracy()); // terminal fall speed, I presume

mBulletCharacterControl.setGravity(Physics.G * getBulletAccuracy());




And, on my Ship wrapper object:

CollisionShape sceneShape = CollisionShapeFactory.createMeshShape(mShipModelNode);

sBulletDeckRigidBody = new RigidBodyControl(sceneShape, 0f); // zero mass

sBulletDeckRigidBody.setApplyPhysicsLocal(true); // local, not world… the ship will move!



Is there something I can do to have mShipModelNode, rather than rootNode used as the root of my PhysicsSpace?


Happy day!

I succeeded by adding sBulletDeckRigidBody.setKinematic(true)

My ship now can be at different translations and my foot-fall finds solid deck underneath.


1 Like