sheik266 Posted April 10, 2016 Share Posted April 10, 2016 //in the render function this.game.debug.body(mySprite); this.physics.box2d.debugDraw.centerOfMass = true; The above code only shows the mySprite's physics body, it does not draw the Center of Mass. Note: I am able to render the center of mass with the below code, but it renders it for every physics object. //in the render function this.game.debug.box2dWorld(); this.physics.box2d.debugDraw.centerOfMass = true; Link to comment Share on other sites More sharing options...
megmut Posted April 10, 2016 Share Posted April 10, 2016 I haven't got box2d yet, but could you try ... this.game.debug(mySprite.body); Hope this helps! Link to comment Share on other sites More sharing options...
sheik266 Posted April 10, 2016 Author Share Posted April 10, 2016 No luck with that. I looked into the library's code. It looks like the render flags (ex centerOfMass) aren't even checked. So it seems this feature isn't supported yet :'( Link to comment Share on other sites More sharing options...
Tom Atom Posted April 10, 2016 Share Posted April 10, 2016 I think this will not be possible. Phaser box2D plugin is intermediate layer between Phaser and box2D. As far as I remember box2D is only calling: "ok, now I will draw all joints one by one" and it is up to implementation to provide drawing method (which is what Phaser box2D plugin does in DefaultDebugDraw.js) - thanks to this user can provide drawing methods specific to platform they are running box2D on. There is no option to draw joints (or other properties) only on single object. I believe, that Phaser debug features related to physics will draw properties common for all supported physics engines - like body, but not engine specific ones. Phaser approach allows you to do this on per object basis as you wrote in your original post. Link to comment Share on other sites More sharing options...
Recommended Posts