Vaclav Posted July 23, 2014 Share Posted July 23, 2014 Hello, I experience that once a body in p2 physics has been set to static, then static = false has no effect.The documentation says it should return to dynamic behaviour when static is set to false. What I did:take this example:http://examples.phaser.io/_site/view_full.html?d=p2%20physics&f=static+body.js&t=static%20body After:// Make staticstatic1.body.static = true;static2.body.static = true;Add:static1.body.static = false;static2.body.static = false;Still the bodies remains static. I'm using Phaser 2.0.5. What am I doing wrong? Link to comment Share on other sites More sharing options...
lewster32 Posted July 24, 2014 Share Posted July 24, 2014 Out of interest, what happens if you do the following instead?static1.body.motionState = Phaser.Physics.P2.Body.DYNAMIC; Link to comment Share on other sites More sharing options...
Vaclav Posted July 24, 2014 Author Share Posted July 24, 2014 It doesn't help.I've tried with Phaser 2.0.7 as well. If I set to static with motionState = STATIC and then I set it to DINAMYC it works, however, the static object's collision is not correct (the dynamic object penetrates the static object, then a force is applied to the dynamic body which tosses it away. Link to comment Share on other sites More sharing options...
lewster32 Posted July 24, 2014 Share Posted July 24, 2014 Hmmm, I'm not sure - it sounds like an issue to me, so you may want to post it on Github and see what transpires. Schteppe and Wayfinder are the experts when it comes to P2, so maybe they'll have more to say on the matter. Link to comment Share on other sites More sharing options...
Vaclav Posted July 24, 2014 Author Share Posted July 24, 2014 I've found the solution: one has to restore the body's mass when setting static property to false, because the static body's mass is set to 0.Should I create an issue, or am I expected to set the mass manually? Link to comment Share on other sites More sharing options...
lewster32 Posted July 24, 2014 Share Posted July 24, 2014 I'd say that's an oversight that should be raised, yes. It does make things a little awkward though, as it probably means it'll have to cache the previous mass value in case you changed it from the default. Vaclav 1 Link to comment Share on other sites More sharing options...
Recommended Posts