Jump to content

is onEndContact working reliable in 2.0.5 ?


valueerror
 Share

Recommended Posts



    player.body.onBeginContact.add(function() { console.log('begin'); } , this);
    player.body.onEndContact.add(function() { console.log('end');} , this);


shouldn't this  print out "begin" and "end" on every collision?   "end" is never printed in my testcase...  only begin...  am i doing something wrong?

 

Link to comment
Share on other sites

I' m not sure 2.0.5 has been released yet :)

 

I'm actually trying to put the new version of P2 into my Phaser tests projects, but not so sure as how to do that.

 

Plus, I didn't read everything on the link you've provided, but I don't think the problem George has is the same - seems to be a multi-collision matter...

 

To be brief : I agree with you, onEndContact callbacks are not fired for now ( using 2.0.4 )

Link to comment
Share on other sites

  • 3 months later...

I couldn't get it to work, and I understand that P2 in the current version is the same as it has been for all of the 2.0 releases (maybe earlier, I don't know). I read somewhere that the p2 in Phaser will be upgraded for the next release. I used some short time delays to overcome the worst of the problem for my purposes.

Link to comment
Share on other sites

thanks, I fixed it in phaser.js

    endContactHandler: function (event) {        this.onEndContact.dispatch(event.bodyA, event.bodyB, event.shapeA, event.shapeB, event.contactEquations);        if (event.bodyA.parent)        {            event.bodyA.parent.onEndContact.dispatch(event.bodyB.parent, event.shapeA, event.shapeB, event.contactEquations);        }        if (event.bodyB.parent)        {            event.bodyB.parent.onEndContact.dispatch(event.bodyA.parent, event.shapeB, event.shapeA, event.contactEquations);        }    },
Link to comment
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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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