pandavigoureux29 Posted July 17, 2014 Share Posted July 17, 2014 Hi all, I've come across a problem with groups and P2 bodies. Basically, I have a group, to which I add a Sprite with a P2.Body. So when I move my group, the sprite is actually moving with it, but its body does not budge an inch. Is there a fix to this? Cheers Link to comment Share on other sites More sharing options...
pandavigoureux29 Posted July 21, 2014 Author Share Posted July 21, 2014 In order to make it more understandable, I've done a fiddle example. There, someone may see what's done wrong (or if it's a bug) http://jsfiddle.net/pandavigoureux29/x8y9x/ Cheers. Mefteg 1 Link to comment Share on other sites More sharing options...
JHook Posted July 22, 2014 Share Posted July 22, 2014 What you have happening is that p2 is really a separate system than phaser. Once it's connected to your sprite it becomes the puppet master and phaser handles the front end. So adjusting phaser's group position is only adjusting the way it is rendered, but p2 has no clue. Reading the p2 docs ( http://schteppe.github.io/p2.js/docs/ ) there aren't any group type objects so trying to integrate that directly would be tricky. I would probably write a function that adjusts the p2 bodies directly instead of adjusting the group position. Link to comment Share on other sites More sharing options...
pandavigoureux29 Posted July 22, 2014 Author Share Posted July 22, 2014 Yeah I assumed it was that kind of issue, but shouldn't this represent an actual Phaser issue?One would expect this to naturally work ( well, I do ) Mefteg 1 Link to comment Share on other sites More sharing options...
JHook Posted July 22, 2014 Share Posted July 22, 2014 If phaser was a commercial product I would expect it, but in this context I wouldn't expect the p2 integration to be 100% polished. Of course, it's open source so you can add that functionality! Link to comment Share on other sites More sharing options...
Mefteg Posted July 22, 2014 Share Posted July 22, 2014 In my opinion, it's not a matter of commercial product or not. Phaser is user friendly since the begining! But I agree with you, we should propose a fix to it because it is open source. Link to comment Share on other sites More sharing options...
pandavigoureux29 Posted July 22, 2014 Author Share Posted July 22, 2014 I guess I should wait for the 2.1 then. I think there is some work on P2 that will be done. If the issue is still there I'll try something then. Link to comment Share on other sites More sharing options...
Recommended Posts