natiny.camera.destroy

Lua
natiny.camera.destroy(cam)

Destroys a camera and frees its resources.

Parameters

Name Type Description
cam number Camera handle from natiny.camera.create

Example

Lua
local cam = natiny.camera.create()
-- use cam...
natiny.camera.destroy(cam)

Notes

  • Everything parented to the camera 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.
  • Do not use the camera handle after destroy.