natiny.entity.look_at

Lua
natiny.entity.look_at(node, tx, ty, tz [, upx, upy, upz])

Orients a node to face a target point.

Parameters

Name Type Default Description
node number Entity handle (e.g. model, body, sound source or camera)
tx number Target position X
ty number Target position Y
tz number Target position Z
upx number 0 Up vector X
upy number 1 Up vector Y
upz number 0 Up vector Z

Example

Lua
natiny.entity.look_at(cam, 0.0, 0.0, 0.0)

Notes

  • The up vector defaults to (0, 1, 0) (Y-up) when omitted.
  • If the node is already at the target, or the up vector is parallel to the viewing direction, the call leaves its rotation unchanged.