swissnetizen Posted February 11, 2016 Share Posted February 11, 2016 I'm using P2 physics and I want to disable gravity for some sprites but not all. I've noticed that local gravity is currently unimplemented. I've tried using velocity.y instead of gravity, but it doesn't have the same effect (sprites will float up after reaching the ground). Does any one know how to do this? Link to comment Share on other sites More sharing options...
fillmoreb Posted February 11, 2016 Share Posted February 11, 2016 You could try cheating and accessing internal data of your body. Something like: mySprite.body.data.gravityScale=0; But, I have no idea if that would work. Link to comment Share on other sites More sharing options...
swissnetizen Posted February 11, 2016 Author Share Posted February 11, 2016 That did work, but it also introduced some ghosting. Link to comment Share on other sites More sharing options...
fillmoreb Posted February 11, 2016 Share Posted February 11, 2016 Not sure about the ghosting. I did find an example for gravityScale though, so it's probably not as cheatery as I thought. http://phaser.io/examples/v2/p2-physics/gravity-scale Link to comment Share on other sites More sharing options...
Recommended Posts