natiny_entity_get_parent

C
NatinyEntity natiny_entity_get_parent(NatinyEntity node);

Returns the node this one hangs off, or 0 when it sits at the root.

Parameters

Name Type Description
node NatinyEntity Entity handle

Returns

Type Description
NatinyEntity Parent entity handle, or 0 when the node has no parent

Example

C
NatinyEntity root = hand;
while (natiny_entity_get_parent(root) != 0)
    root = natiny_entity_get_parent(root);

Notes

  • 0 is the same value natiny_entity_set_parent takes to detach a node, so a value read here can be written straight back.
  • A parent that has since been destroyed is reported as 0. That is what the transform already does with it: a released slot is treated as no parent, and the child's local transform is its world one.
  • A handle that is not a live node returns 0.