Sign in to follow this  

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?

Share this post

Link to post
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.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.