Jump to content

Phaser P2 Physics Collision Offset


Pamplemaus
 Share

Recommended Posts

Hi, I have been trying making a simple stacking game with Phaser and the P2 physics system and have run into a bit of a snag with my collision checking.

What I want to happen is for a block to turn a color depending on order when it is stacked on top of another block. I was pointed to, or found in phaser examples, the broadphase callback to do my collision object checking which is kinda working but the collision box seems to be off a little bit. Specifically it seems to be offset to the left so that the block will only change color if they are "hanging off the left side" of the block below it.  I have tried a few things but not being very versed in the engine none have remedied the issue.

Here is the code I am using for the game so you can test and fiddle through it : http://pastebin.com/5jB7xJpK

And I have attached two photos documenting the behavior. I imagine this is a simple fix involving something I may have overlooked but it has been frustrating me lately. Any help or pushes in the right direction would be greatly appreciated. Cheers.

ref1.PNG

ref2.PNG

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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