natiny.entity.set_rotation

Lua
natiny.entity.set_rotation(node, space, rx, ry, rz)

Sets the rotation of a node in the given coordinate space.

Parameters

Name Type Description
node number Entity handle (e.g. model, body, sound source or camera)
space integer natiny.entity.SPACE_LOCAL or natiny.entity.SPACE_WORLD
rx number Rotation around X axis in degrees
ry number Rotation around Y axis in degrees
rz number Rotation around Z axis in degrees

Example

Lua
local cube = natiny.model.create(natiny.mesh.cube(1))
natiny.entity.set_rotation(cube, natiny.entity.SPACE_LOCAL, 0.0, 45.0, 0.0)

Notes

  • Use SPACE_LOCAL for parent-relative rotation, SPACE_WORLD for absolute rotation.