GameDemon Posted September 7, 2016 Share Posted September 7, 2016 How do you tell if a P2 body is sleeping? I cant see any property for that on Body, only `allowSleep` and `sleepSpeedLimit` (both of those undocumented btw). I just have some simple circle bodies with gravity atm, I wanted to colorise the sleeping bodies for debug purposes. I tried turning p2 sleepmode on by declaring `game.physics.p2.sleepMode = 2;` I'm not sure how to set this properly, I saw World.BODY_SLEEPING=2 in the Phaser source, with standalone p2 its set via `p2.World.BODY_SLEEPING;` tips4design 1 Link to comment Share on other sites More sharing options...
tips4design Posted September 7, 2016 Share Posted September 7, 2016 I was looking exactly for the same thing yesterday, didn't find an answer yet. I set it like this I think, from the constants in the world object: game.physics.p2.sleepMode = game.physics.p2.world.BODY_SLEEPING GameDemon 1 Link to comment Share on other sites More sharing options...
GameDemon Posted September 7, 2016 Author Share Posted September 7, 2016 Thanks Mr. Tips `console.log(game.physics.p2.world.BODY_SLEEPING)` is undefined for me. P2 docs show a property called sleepState:http://schteppe.github.io/p2.js/docs/classes/Body.html#property_sleepState but in Phaser `body.sleepState` is undefined… hm it feels like sleeping is removed from Phaser P2? tips4design 1 Link to comment Share on other sites More sharing options...
Recommended Posts