Make body stay fixed to the ground

Hi,

How would I make a box2d body stay fixed to the ground, for instance, if the ground was a set of hills, how could I make it stick to them so as not to jump in the air when going up a hill fast. Hope you know what I mean?

Somebody did mention applying a constant down force to the box2d body's normal, how would I do this?

Thanks
Applying a force downwards (ApplyLinearForce) is probably the simplest solution, but it will not do the job perfectly because when the body is moving at speed and the ground drops away under it, there will always be a short time that it is off the ground. It will also make it much harder for the character to go up hills.

Any time you want to create non-realistic physics like this, you'll find yourself fighting with the engine because the engine is trying very hard to create realistic physics. In these situations you might actually be better off with a non-realistic approach, eg. in this case you could cast a ray downwards from the body to see how far off the ground it is, then just set the y value of it's position directly (SetTransform).

Original thread: https://box2d.org/forum/viewtopic.php?t=7110