Rotational Moving Platforms

Julian Spillane
Posts: 9
Joined: Tue Aug 12, 2008 9:15 pm

Rotational Moving Platforms

Post by Julian Spillane »

Hi all,

I am trying to figure out how to implement rotational moving platforms in our game (such as a spinning gear, merry-go-round, etc.) such that the player inherit's both rotational and translational motion. We currently implement linear moving platforms by adding objects' velocities with the velocity of the object that they are on (taking into account frames of reference, of course).

I've included a picture to give an idea of what I'm talking about.

I thought about coding some kind of "frame of reference" constraint, wherein body A is positioned relative to body B until such time that the constraint is removed, but there must be a better way.

Thanks a lot for your time.
rotatingPlatformExample1.jpg
You do not have the required permissions to view the files attached to this post.
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: Rotational Moving Platforms

Post by pico »

Hi,

the solution is very easy. Instead using getLinearVelocity from the elevator use getVelocityInLocalPoint. As local point use the intersection from elevator and your body or simply the middle of your characters bottom. From this i also calculate an y axis rotational offset, which is enough for our game ( character is always facing up)
Julian Spillane
Posts: 9
Joined: Tue Aug 12, 2008 9:15 pm

Re: Rotational Moving Platforms

Post by Julian Spillane »

Thank you very much! That worked perfectly for us. I can't believe I didn't think of that... thanks!
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: Rotational Moving Platforms

Post by pico »

Julian Spillane wrote:Thank you very much! That worked perfectly for us. I can't believe I didn't think of that... thanks!
Simple but effective :)

You should keep an eye on large rotating plattforms. Those introduce (at least for me) less spin that would be needed, and so the body that is standing on them is left behind. Its only a tiny bit each step but its enough to break the correct movement. It seems only to depend on the plattform size, not on the movement radius. So a small plattform rotating around a far away pivot doesnt introduce the problem but a large plattform that is centered on the same pivot suffers from the problem.