Making bodies stick to the ground

Mar 5, 2010 at 11:59 AM

Hey again

I am currently programming for a platform game using farseer. The surface of the platforms are not always even, and so I have problems with the player colliding with "bumps" in the ground, which he should just step over (when it works as it should).

So, is there any way to make bodies stick to eachother temporarily? A temporary joint perhaps?

If you have any ideas, please share.
Thank you.

Mar 5, 2010 at 6:09 PM

To be honest, the solution you provided isn't specific enough. I don't understand.

However, in my platforming game, I am using a circular geometry near the feet of my player- this makes it so the corners of tiles in my game do not collide together at a high force (causing the bumps).

I don't understand the sticking and the joints you're talking about =(.


Mar 5, 2010 at 8:55 PM

I think the solution you want is to use a circular geometry/body at the foot of the player and not some complicated hacked solution like the one you are proposing. You can search the forums for the block and ball method that Caseyyano has described.

Mar 6, 2010 at 4:37 PM
Edited Mar 6, 2010 at 4:59 PM

I was afraid that my explanation of the problem might have been lacking, transfering a graphical thought to text form isn't the easiest thing though (have pity).

I am actually currently using a circular body at the feet of my player when I experience this problem. (Gah! Is there any way to upload screenshots here?) I'll try to explain the problem in greater detail:

The player moves at a relatively high speed towards a small elevation in the terrain (a partially submerged circle for example, although a rectangle would serve just as well), the player collides with this obstacle. Because of this he "staggers" forward, i.e. he loses contact with the ground but continues to move, only now he is temporarily airborne.

Now, what I want to do is to find some way to make the character move over small obstacles like this, (kind of like how a tank running on continous tracks moves). I tried increasing the gravity but that simply made it harder for me to keep the character still when he stands on a slope.

Anywho, I appreciate that you took the time to answer. Did I make myself any clearer this time? ^^

Perhaps you have any new ideas?

Yakbutter out.

Mar 6, 2010 at 6:55 PM

geom.FrictionCoefficient = 2f;

this should prevent sliding.

Adjust as needed- obviously the more steep a hill, the harder it will be for your character to climb.

Mar 7, 2010 at 1:15 PM

Easying the climb wont be really difficult as I can just decrease the friction when the character is told to move. I didn't think of it, but drastically increasing gravity as long as the character is not jumping or falling, and upping the friction, might solve this.

I'll try it out.

Again, thanks for the help :)