natiny.entity.set_rotation
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
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_LOCALfor parent-relative rotation,SPACE_WORLDfor absolute rotation.