Jump to content

No bounce-back effect


Novocaine
 Share

Recommended Posts

When implementing collision with P2, I can't seem to get rid of a small bounce-back effect.

 

Example: http://test.xapient.net/phaser/tilemapexample/index-p2.html

 

In this example, when Mario jumps on the ground, it gets a little bit below the ground and then smoothly moves up quickly to stand on it. This doesn't happen with the Arcade physics and I can't seem to get rid of it with P2. Also every other example I've looked at has this effect and I tried several parameters.

 

Since I only need AABB collisions, another approach I tried is implementing the collision myself in the update() routine.

 

A very simple example for just a general ground would be:

if (player.body.y >= 500) {    player.body.y = 500;    player.body.velocity.y = 0;}
In this case, for one frame, the player appears below the ground. I assume this is, because this calculation would need to be done between the P2 physics calculations and the rendering, but the update() happens before the P2 physics calculations.
 
Does anyone know how to around this bounce-back effect I'm describing?
 
Cheers!
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...