natiny.pivot.create
Lua
natiny.pivot.create([parent]) -> pivot
Creates a transform-only entity for grouping and positioning child entities.
The pivot itself is not rendered and produces no audio.
Parameters
| Name |
Type |
Default |
Description |
parent |
number |
nil |
Parent entity handle, or nil to create the pivot at the scene root |
Returns
| Type |
Description |
number |
Pivot handle, also usable with the natiny.entity API |
Example
Lua
local turret = natiny.pivot.create(tank)
natiny.entity.set_position(turret, natiny.entity.SPACE_LOCAL, 0, 1.2, 0)
natiny.entity.set_parent(barrel, turret)
Notes
- The initial local position and rotation are
0; the initial scale is 1
on every axis.
- Use the
natiny.entity API to transform or
reparent a pivot.
- Lua raises an error if creation fails or if
parent is 0. Omit parent
or pass nil to create a root pivot.
- Destroy the pivot with
natiny.pivot.destroy. Destroying it
also destroys its descendants.