Mar 27, 2009 at 7:57 PM
Edited Mar 27, 2009 at 7:58 PM
Well let me try to help
1. For friction
Create a body and a geom for the character,
make him like you normaly would.
But then change his friction coefficient.
This resides in the body or geom class i cant remember
basically make his body and geometry then say
body.frictioncoefficient = 0.1f;
(or geom.frictionCoefficient = 0.1f;)
then create a body and geom for the floor
then change its friction coefficent
floorbody.frictionCoefficient = 0.2f;
(or whatever, just not 0)
play aroud with the numbers, the simulator takes the numbers from the colliding objects and gets the average number between them.
So when the player moves on the floor he will have a Friction of 0.15f.
For movement do this
body.ApplyForce(new vector2(200, 0));
body.applyforce(new vector2(-200, 0));
this will push your character in the x direction but not the y, his top force will be whatever x you set
This works very well and i use this method.
Hopefully this helped, obviously the code above is sloppy but Farseer does alot of the work for you in cleaing it up(dont copy and paste it).
If you want i can just create a small sample, of course its quite simple so there wont be much need for it.