natiny.entity.rotate

Lua
natiny.entity.rotate(node, space, drx, dry, drz)

Rotates a node by a delta 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
drx number Rotation delta around X axis in degrees
dry number Rotation delta around Y axis in degrees
drz number Rotation delta around Z axis in degrees

Example

Lua
local cube = natiny.model.create(natiny.mesh.cube(1))
-- Spin the cube 1 degree per frame around Y
natiny.entity.rotate(cube, natiny.entity.SPACE_LOCAL, 0.0, 1.0, 0.0)

Notes

  • Unlike set_rotation, this adds to the current rotation rather than replacing it.
  • Use SPACE_LOCAL to rotate around the node's own axes.