Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

How do I remove the debug draw sprites from a physics body?


deedeekaka
 Share

Recommended Posts

Hello,

I've been following a Phaser spring example and I've been trying to remove the overlay sprite it draws on my circular physics body (I assume it adds this when I call body.setCircle(5)).

Does anyone know how to remove this? I don't want to remove the body, I still want the physics, I just don't want the extra debug drawn sprite.

Thanks ^_^

Link to comment
Share on other sites

Phaser won't draw debug bodies automatically unless instructed to - you control this by setting the 'debug' flag when the body is enabled:

game.physics.p2.enable([ contra, bunny ], true);

Here we enable a P2 body, with debug, on two Sprites. Change the 'true' to 'false' (or just remove it) and they won't have debug bodies.

Link to comment
Share on other sites

11 hours ago, rich said:

Phaser won't draw debug bodies automatically unless instructed to - you control this by setting the 'debug' flag when the body is enabled:


game.physics.p2.enable([ contra, bunny ], true);

Here we enable a P2 body, with debug, on two Sprites. Change the 'true' to 'false' (or just remove it) and they won't have debug bodies.

Thanks a ton!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...