Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a platform with btBoxShape as shape, and I want to rotate it every certain amount of time to simulate a rotating platform.

Right now I rotate it with Ogre (my rendering engine) and use a custom btMotionState to synchronize it with bullet. The thing is that when a player goes on top of it (a player is a btRigidBody with mass 1) the body should stay in the same coordinate relative to the platform and rotate with it. Right now it is kinda bugged and it doesn't rotate properly, and I don't know the exact cause.

What should I do to achieve this effect?

Here is a video with an example of what I want to do:

share|improve this question

Add a boolean "on_ground" variable to keep track of if your player is standing, or in midair. Ray cast underneath the player just like you would to see if it is OK to jump.

If your player->on_ground is false, and the ray hits something to stand on, make this object your new "platform" and set player->on_ground to true. Save the local (not world) coordinate where the ray hit as your "platform_offset". You can get this by taking the world space position where the ray hit, and transforming it by the inverse of the platform's model matrix.

Otherwise, if player->on_ground is true, then you just transform the platform_offset by the platform's model matrix. Move the player with it artificially if the platform has moved.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.