Jump to content

p2 physics weird behavior


Recommended Posts

Recently I played with p2 physics in Phaser and noticed a strange behavior of a body.

Here is a scene for demonstration: click

I think that dynamic body (which is made of two rectangles) after colliding with static body should fall to the right side, but not balance on the static body. I tried to call adjustCenterOfMass() method after adding rectangles, but it didn't help.


So the question is: how to make the dynamic body to behave natural?

Link to comment
Share on other sites

Yeah, I tried to uncomment this line


but other weird things happen



1. The dynamic body falls below the bottom edge of canvas

2. This body starts to penetrate with static body

3. The body stops moving before touching the right edge.

I have a feeling that after adjusting center of mass some p2's internal stuff brokes and render debug shifts from the actual physics position.

Link to comment
Share on other sites


  • Recently Browsing   0 members

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