Mouving Plateform

Topics: Developer Forum
Sep 8, 2009 at 12:36 PM
Edited Sep 8, 2009 at 12:37 PM

Hello, I'm working on a plateform game with farseer, everything run fine, really, thanks for the librairy

But I'm encountering a problem with mouving plateform, I have a block, fixed to a wheel, when the player jump on it, i'd like to make him follow is mouvement.

In reality, it migth be achieved by friction no ? how can I simulate this effect ? I tried with myGeom.FrictionCoefficient, nothing changed,
I suppose gravity on the block is hiding the friction effect on the player.

Additional Question: With a horizontal mouving plateform, frictioncoeff would work or here too, another tweak is needed ?


(sorry english isn't my natural langage)

Sep 8, 2009 at 4:20 PM

Are you moving the platform manually? If you change the position of the platform manually, the physics engine have no idea that it moved and thus it can't calculate proper friction. (no velocity = no friction).

You will have to use impulse and force to move the platform and have a high friction on both the character and platform. This will give the proper physics reaction to a moving platform.

Most games (that I know of) move the platform manually and find some kind of trick to make the character stay on the platform. An example would be that the character's position is manually set along with the platform position. I've seen this question before and it has been answered a couple of times. Try searching the forums. (or google - it is a widely known question)

Sep 8, 2009 at 5:04 PM

I do it in the farseer way, revolute join and gravity does a really good job :)

I might found the problem, I'm using a circle as player and it's react better with a simple rect in this case :/
but is there any way to "amplify" this reaction with a circle which I'd rather keep 'cause it's far better in other case ? (the rect "jump" sometimes, some rounding error explosion I guess)

Using both of them with specific collisioncategory sounds bad no ?

Sep 8, 2009 at 7:30 PM

Do you mean jump when the platform is moving up or down? When it is moving down, the force you apply to the platform is greater than what gravity can apply alone to the player standing on top. This will cause the platform to move down faster than the character is able to.

If you mean on the way up, then it could be several things. If it moves at a high speed or you use a high timestep it could be tunneling or it could be your setup of the geometries that cause the problem.

You could you zip your code and send it to me or create a video of what is happening? You can send stuff to me by contacting me using codeplex and I will reply with my email.

Sep 8, 2009 at 9:30 PM

Sorry I wasn't really clear :

In my level, I have these wheeling plateform, and another part where there is many rectwall with a fixed size.  ([a][b][c][d])

If I use a rectangle body for my player, the wheel works fine, friction "freeze" player on the mouving plateform, but in the "tile walls" part, the player got stuck between junction and sometimes jump in the air (as it's happen frequently in 3D engine were overlapping objects start to shake then are propulsed).

On the contrary if I set a circle body, the "tile walls" work fine, but wheel friction can't stop him (point contact instead of surface contact).

I use a trivial bodyfactory.rect (and geom), with an applyforce at every update depending on the input,...

If there is a way to correct the rectangle problem it would be awesome, or at least, I can use the two geometries with specific collisioncategories but it sounds really bad to me.