Type Function Library physics.* Return value Boolean Revision Release 2022.3683 Keywords physics, bodies, physics body See also physics.addBody()
Removes a physics body from a display object without destroying the entire object. This removes the body created with physics.addBody().
This API only removes the physics body from the DisplayObject — it does not remove the display object itself.
This function returns true
if the body was removed and false
if the call failed. The API will fail if called in any collision event listener.
This call cannot be used in a collision event. However, your collision handler may set a flag or include a time delay via timer.performWithDelay() so that the action can occur in the next application cycle or later. See the Collision Detection guide for a complete list of which APIs and methods are subject to this rule.
physics.removeBody( object )
DisplayObject. The object whose physics body should be removed.
if not ( physics.removeBody( object ) ) then print( "Could not remove physics body" ) end