natiny_entity_rotate
void natiny_entity_rotate(NatinyEntity node, uint32_t space, float drx, float dry, float drz);
Rotates a node by a delta in the given coordinate space.
Parameters
| Name | Type | Description |
|---|---|---|
node |
NatinyEntity |
Entity handle |
space |
uint32_t |
NATINY_SPACE_LOCAL or NATINY_SPACE_WORLD |
drx |
float |
Rotation delta around X axis in degrees |
dry |
float |
Rotation delta around Y axis in degrees |
drz |
float |
Rotation delta around Z axis in degrees |
Example
NatinyModel cube = natiny_model_create();
natiny_model_set_mesh(cube, natiny_mesh_cube(1.0f, 1.0f, 1.0f, 1));
/* Spin the cube 1 degree per frame around Y */
natiny_entity_rotate((NatinyEntity)cube, NATINY_SPACE_LOCAL, 0.0f, 1.0f, 0.0f);
Notes
- Unlike
natiny_entity_set_rotation, this adds to the current rotation rather than replacing it. - Use
NATINY_SPACE_LOCALto rotate around the node's own axes.