Game Physics: Implementing Normal Reaction from ground correctly

Posted by viraj on Game Development See other posts from Game Development or by viraj
Published on 2012-10-29T16:10:49Z Indexed on 2012/10/29 17:25 UTC
Read the original article Hit count: 397

I am implementing a simple side scrolling platform game. I am using the following strategy while coding the physics:

  • Gravity constantly acts on the character.
  • When the character is touching the floor, a normal reaction is exerted by the floor.

I face the following problem:

If the character is initially at a height, he acquires velocity in the -Y direction. Thus, when he hits the floor, he falls through even though normal force is being exerted. I could fix this by setting the Y velocity to 0, and placing him above the floor if he has collided with it. But this often leads to the character getting stuck in the floor or bouncing around it. Is there a better approach ?

© Game Development or respective owner

Related posts about physics

Related posts about 2d-physics