• 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.

    Parameters

    • whichUnit: Unit<UnitEventMap>

      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<UnitEventMap>

      The bone will be locked to face this unit.

    • offsetX: number

      The x-offset from lookAtTarget's origin point.

    • offsetY: number

      The y-offset from lookAtTarget's origin point.

    • offsetZ: number

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

    Returns void

    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.

Generated using TypeDoc