Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken P2 physics (world) bounds since Phaser 2.7.0 #493

Open
flowbytes opened this issue Mar 11, 2018 · 4 comments
Open

Broken P2 physics (world) bounds since Phaser 2.7.0 #493

flowbytes opened this issue Mar 11, 2018 · 4 comments

Comments

@flowbytes
Copy link

This Issue is about

  • A bug in the API:
    • Phaser version(s): tested 2.6.2, 2.7.0 and 2.10.1
    • Live example: https://codepen.io/anon/pen/bvNXmW
    • What should happen: physics left bound should stop player
    • What happens instead: player can move right through until he hits world bound with very strange effect

There seems to be an issue with world bounds or to be more precise a combination of world bounds and P2 physics bounds that has been introduced in Phaser 2.7.0 and is still there in 2.10.1.
Setting up a world with world bounds slightly bigger than P2 physics bounds has the effect that top, right and bottom bounds work as expected but left is broken.
Same code is working fine in Phaser 2.6.2.

Working (2.6.2): https://codepen.io/anon/pen/GxgVQp
Broken (2.7.0): https://codepen.io/anon/pen/bvNXmW

@samme
Copy link
Collaborator

samme commented Mar 12, 2018

See also #409

@jbpuryear
Copy link
Contributor

p2.setBounds sets p2.walls.left.angle to 1.5707963267948966. Setting this to a different number--even just changing the least significant digit--seems to fix collisions. (Make sure you actually change it though. On my machine if I try to set it to ...965 javascript actually sets it back to ...966.)

Could be some sort of rounding error in P2JS's collisions. Maybe @schteppe has some insight?

@schteppe
Copy link

I haven’t debugged this, but my guess is that it’s about a p2.Plane shape. There’s optimized code paths for vertical/horizontal planes, and they had bugs in them at one point... what version of p2 is this?

@jbpuryear
Copy link
Contributor

@schteppe It looks like we're using v0.7.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants