natiny_entity_get_rotation
void natiny_entity_get_rotation(NatinyEntity node, uint32_t space, float* rx, float* ry, float* rz);
Writes the orientation of a node, in degrees, into three output parameters.
Parameters
| Name | Type | Description |
|---|---|---|
node |
NatinyEntity |
Entity handle |
space |
uint32_t |
NATINY_SPACE_LOCAL or NATINY_SPACE_WORLD |
rx |
float* |
Receives rotation around X, in degrees; may be NULL |
ry |
float* |
Receives rotation around Y, in degrees; may be NULL |
rz |
float* |
Receives rotation around Z, in degrees; may be NULL |
Example
float yaw;
natiny_entity_get_rotation(turret, NATINY_SPACE_WORLD, NULL, &yaw, NULL);
natiny_entity_set_rotation(barrel, NATINY_SPACE_WORLD, 0.0f, yaw, 0.0f);
Notes
- Degrees, the same units
natiny_entity_set_rotationandnatiny_entity_rotatetake. - The angles are applied in Y-X-Z order - yaw, then pitch, then roll - which is
the order
natiny_entity_set_rotationreads them in. NATINY_SPACE_LOCALreturns the stored parent-relative angles, which is exactly whatnatiny_entity_set_rotationwrote in the same space.NATINY_SPACE_WORLDcomposes them with every parent's and decomposes the result.- A world read answers with one triple naming that orientation, not necessarily the triple that was written: past ±90° of pitch, and at gimbal lock, a different triple describes the same rotation. Compare orientations, not the numbers.
- A handle that is not a live node writes
0to every non-NULLoutput.