SetUnitLookAt

Parameters
whichUnit unit

The unit that will have its bone locked to face the target.

whichBone string

The bone to lock onto the target. The engine only supports locking the head and the chest. To lock the head, you can put in any input except a null string. To lock the chest, the string must start with "bone_chest". All leading spaces are ignored, it is case insensitive, and anything after the first non-leading space will be ignored.

lookAtTarget unit

The bone will be locked to face this unit.

offsetX real

The x-offset from lookAtTarget's origin point.

offsetY real

The y-offset from lookAtTarget's origin point.

offsetZ real

The z-offset from lookAtTarget's origin point (this already factors in the terrain Z).

comment

Locks a unit's bone to face the target until ResetUnitLookAt is called.

The offset coordinates ( X, Y, Z ) are taken from the target's origin. The bones will lock to the lookAtTarget, offset by those coordinates. You can't have both the head and the chest locked to the target at the same time.

note

The parameter whichBone can only move the head bones and the chest bones. All other input will default to the head bone. However, the function only looks for the helper named "Bone_Head" (or "Bone_Chest") in the MDL, so you can just rename a helper so that it will move that set of bones instead.

note

SetUnitLookAt is affected by animation speed and blend time.

note

How to instantly set a unit's facing.

patch

1.00

return type
nothing
Source code
native          SetUnitLookAt       takes unit whichUnit, string whichBone, unit lookAtTarget, real offsetX, real offsetY, real offsetZ returns nothing
Source
common.j
wc3modding.com
SetUnitLookAt