natiny.physics.destroy
natiny.physics.destroy(body)
Removes a body from the world and frees its entity.
Parameters
| Name | Type | Description |
|---|---|---|
body |
number |
Body handle |
Example
natiny.physics.destroy(body)
Notes
- Everything parented to the body is destroyed with it, and so is everything parented to those, all the way down. Each one goes through the destroy its own kind has, so a child model gives back its parts, a child body leaves the physics world and a child source releases its voice - a subtree is freed as completely as its nodes would be one at a time.
- Detach a child to keep it:
natiny.entity.set_parent(child, 0)leaves its local transform as its world transform, and the destroy passes it by. - Does nothing for a handle that is not a live body, so destroying twice is safe.