natiny_physics_destroy

C
void natiny_physics_destroy(NatinyBody body);

Removes a body from the world and frees its entity.

Parameters

Name Type Description
body NatinyBody Body handle

Example

C
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.