The Physics Body is typically linked to a single Sprite and defines properties that determine how the physics body is simulated.
The Physics Body is typically linked to a single Sprite and defines properties that determine how the physics body is simulated. These properties affect how the body reacts to forces, what forces it generates on itself (to simulate friction), and how it reacts to collisions in the scene. In most cases, the properties are used to simulate physical effects. Each body also has its own property values that determine exactly how it reacts to forces and collisions in the scene. By default a single Rectangle shape is added to the Body that matches the dimensions of the parent Sprite. See addShape, removeShape, clearShapes to add extra shapes around the Body. Note: When bound to a Sprite to avoid single-pixel jitters on mobile devices we strongly recommend using Sprite sizes that are even on both axis, i.e. 128x128 not 127x127. Note: When a game object is given a P2 body it has its anchor x/y set to 0.5, so it becomes centered.
Draws a P2 Body to a Graphics instance for visual debugging.
Draws a P2 Body to a Graphics instance for visual debugging. Needless to say, for every body you enable debug drawing on, you are adding processor and graphical overhead. So use sparingly and rarely (if ever) in production code.
Also be aware that the Debug body is only updated when the Sprite it is connected to changes position. If you manipulate the sprite in any other way (such as moving it to another Group or bringToTop, etc) then you will need to manually adjust its BodyDebug as well.