Oct 18, 2009 at 9:20 PM
Edited Oct 19, 2009 at 7:03 PM
To begin with, I am not a professional programmer, but enjoy doing it as a hobby. That said, I have already asked in recent posts, and will probably continue to ask very noob questions. Sorry in advance.
I know this 'tripping' is caused by the Player Geom hitting the corners of the Platform tiles (which are all also Bodies with Geoms), and thus the Player sometimes doesn't know whether to 'fall off' one tile corner or 'go up' the next tile corner, instead
of just going straight.
Here is some of what I have:
Player.Geom is a simple rectangle with collisionGridSize set to 0.
The Player.Body mass is set at 0.1.
Player.Geom.FrictionCoefficient = 0.1f;
Player.Geom.RestitutionCoefficient = 0f;
Player.Body.ApplyForce (new Vector2(0, 250) in the Update method for gravity.
The PlatformTiles.Body == static.
Tile.Geom.FrictionCoefficient = .0f;
PlatformTiles.Geom is a rectangle with collisionGridSize at 0.
My player has very minimal 'bounce', and I am OK with the movement of the player, but sometimes he 'trips' and falls over (mostly when I jump).
Is there something I should try different.
Maybe I can write an algorithm that keeps the player 1 or 2 pixels off the platform at all times?
Or maybe I should try using a circle Geom at the player's feet?
If there is anyone who has dealt with these issues and can point me in the right direction, that would be great.
EDIT: figured it out. I created a player body with a circle geom at his feet and a rect geom for his body. Then used an angle joint to keep him upright at all times. Works great and I also got rid of any 'bouncing' I had with a little tweaking of the gravity,
mass, friction, etc. I know this is beginner's stuff, but someone who is a beginner (like me) may be interested.