natiny_entity_get_position
void natiny_entity_get_position(NatinyEntity node, uint32_t space, float* x, float* y, float* z);
Writes the position of a node in the given coordinate space into three output parameters.
Parameters
| Name | Type | Description |
|---|---|---|
node |
NatinyEntity |
Entity handle |
space |
uint32_t |
NATINY_SPACE_LOCAL or NATINY_SPACE_WORLD |
x |
float* |
Receives position X; may be NULL |
y |
float* |
Receives position Y; may be NULL |
z |
float* |
Receives position Z; may be NULL |
Example
float x, y, z;
natiny_entity_get_position(player, NATINY_SPACE_WORLD, &x, &y, &z);
natiny_entity_set_position(camera, NATINY_SPACE_WORLD, x, y + 1.7f, z);
Notes
NATINY_SPACE_LOCALreturns the stored parent-relative position, which is exactly whatnatiny_entity_set_positionwrote in the same space.NATINY_SPACE_WORLDreturns the absolute position the parent chain places the node at.- The world position is read from the node's world matrix after the parent chain is brought up to date, so it already accounts for moves made earlier in the same frame.
- For a body, the world position is where the last physics tick left it, or the
interpolated position when
natiny_physics_set_interpolationis enabled for that body. - A handle that is not a live node writes
0to every non-NULLoutput.