Raycast with P2 physics only hitting world bounds, not bodies

Recommended Posts

Runnable code here: https://github.com/darkf/grr

I'm using P2 physics and I'm trying to raycast to the mouse position. I've got a tilemap with physics bodies set up, and they show fine with debug draw on.
However, the ray never hits any of the tile bodies, nor the player body. It only hits the top and left side of the world bounds.

Screenshots attached.

Is there anything obvious I'm doing wrong, or is this a bug?



Share this post

Link to post
Share on other sites
1 hour ago, rich said:

I'm confused, which are you using, p2 or Box2D? Because the second message implies Box2D, but the first P2. They're not interchangeable.

I'm using P2 myself. My second post was remarking that the Box2D example is also similarly broken -- so it might be a Phaser issue rather than a P2/Box2D one.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.