Horizontal moving platforms

josemarin02
Posts: 3
Joined: Thu Mar 06, 2008 12:00 pm

Horizontal moving platforms

Post by josemarin02 »

Hi.

On my game, there are some horizontal moving platforms (simple boxes). The user can step on the top of one of these platforms, and the platform will move to another place (horizontally), carrying the player with it.

But the player doesn´t follow the platform! He keeps on the same position, untill falling on the ground after the platform is away.

Is there some way of the player follow the platform move?

Thanks!
Nacho
Posts: 31
Joined: Tue Mar 04, 2008 1:41 pm

Re: Horizontal moving platforms

Post by Nacho »

I suppose your player character is a kinematic object.

I do that:

-Save pointer to the object in which the character is on and its relative position/rotation from it.
-Move objects (kinematics, like platform, and dynamics with stepSimulation).
-Update character position using saved relative pos/rot and object (if the object is static or it hasn't moved, no update is necessary)
-Apply character movement from input (keys/mouse/pad) or animation...
-Update saved pointer to the object under the character and character's relative pos/rot from object.
-Repeat all process

In response to Erwin's "challenge" in http://www.bulletphysics.com/Bullet/php ... 1951#p7471, I was thinking to do a little demo with moving platforms and some slope.

Nacho
josemarin02
Posts: 3
Joined: Thu Mar 06, 2008 12:00 pm

Re: Horizontal moving platforms

Post by josemarin02 »

Hmmm, I understand.

So, it´s not enought to set some high friction on the paltform, right?
Nacho
Posts: 31
Joined: Tue Mar 04, 2008 1:41 pm

Re: Horizontal moving platforms

Post by Nacho »

If the character is a kinematic object, the friction has no influence in it.

Nacho