This project has moved and is read-only. For the latest updates, please go here.

[Solved] Problem : Player does not move along with moving platform

Oct 25, 2012 at 12:55 PM

Hi guys ,

Another new guy here.

Anyways I'm new to farseer and so far i'm amazed by all the stuff you can do with it. 

I'm trying to work out some platform game and I've stumbled upon a rather "basic" problem. I'm trying to make a vertical moving surface/platform , and i want my player to be able to walk on it. However , when the platform starts descending, the player (naturally, since he's not connected to the platform) does not "stick" to it.

(Pic of the problem)

I've also attached a testbed scenario to reproduce my problem. (Link from my dropbox here)


I've tried :

1. Increased the mass of the player circle , and make the surface kinematic (so that when the player steps on it , does not drag it down cause of his mass)


I'm thinking of subscribing to the surface's OnSeparation, and apply the downward velocity/force manually (since the moving platform has constant moving speed), or maybe even when i switch the moving direction..

Is there any better way to implement this ? Any suggestions?


- Andrei

Oct 25, 2012 at 7:08 PM

I found out that the problem was the Inertia of the circle Body i used to move the player.

playerCircle.Inertia = <some high value , i experimented with values 100 - 1000 > fixed it for me. 

Oct 25, 2012 at 7:39 PM

What happens is that when going up the platform is pushing on the player with a certain force. Once the platform changes direction the body continues to move up a bit until acceleration goes to 0 due to gravity acting and the player starts falling. It's the same if I hold something in my hand moving up and then suddenly release it. It would also happen if I hold my hand still and suddenly open it and move it down quick.

Your suggestion of applying a downward force is a good one. The issue goes away by just doing:


Of course you'll need to figure out when the player is actually standing on a platform. You can use contact listeners on the circle or an sensor fixture to represent the "feet" and use listeners on that.