valueerror Posted May 2, 2014 Share Posted May 2, 2014 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 More sharing options...
valueerror Posted May 5, 2014 Author Share Posted May 5, 2014 https://github.com/schteppe/p2.js/issues/90 looks like it is not.. Link to comment Share on other sites More sharing options...
pandavigoureux29 Posted May 5, 2014 Share Posted May 5, 2014 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 More sharing options...
valueerror Posted May 5, 2014 Author Share Posted May 5, 2014 im using the dev branch 205 and i believe this has nothing to do with phaser but with the updated version of p2 Link to comment Share on other sites More sharing options...
pandavigoureux29 Posted May 5, 2014 Share Posted May 5, 2014 Yeah that's why I searched a way to update P2 without updating Phaser. I'll see that tomorrow. Link to comment Share on other sites More sharing options...
valueerror Posted May 6, 2014 Author Share Posted May 6, 2014 hmm.. you could grab the new p2 js files https://github.com/schteppe/p2.js/tree/master/src replace the old ones in the phaser/src/physics/p2 folder and rebuild phaser with grunt... but i don't know if this works because i don't know if rich patches those files first or something else.. Link to comment Share on other sites More sharing options...
pandavigoureux29 Posted May 6, 2014 Share Posted May 6, 2014 I'm not sure either what happens here. The P2.js from src just references modules to load, but I can't find any of P2 src in phaser-master, so I guess I would have to rebuild P2. But I'm not so sure about that. Maybe I'll just cross my fingers waiting for 2.0.5. Link to comment Share on other sites More sharing options...
MXPain Posted August 26, 2014 Share Posted August 26, 2014 Guys, onEndContact is still not working? Link to comment Share on other sites More sharing options...
spencerTL Posted August 26, 2014 Share Posted August 26, 2014 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 More sharing options...
wayfinder Posted August 27, 2014 Share Posted August 27, 2014 There's a typo in p2's endContactHandler function where it dispatches onEndContact events only to one of the participating bodies. You can fix it yourself in phaser.js. Link to comment Share on other sites More sharing options...
MXPain Posted August 27, 2014 Share Posted August 27, 2014 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 More sharing options...
Recommended Posts