• Makes the unit slowly turn around on the spot to look at new direction, the turn speed can be modified with duration.

    Parameters

    • whichUnit: Unit<UnitEventMap>

      Target unit.

    • facingAngle: number

      New angle in degrees (direction), see: SetUnitFacing.

    • duration: number

      Value >= 0 and < 1: same turn speed as SetUnitFacing.

      Values >= 1 seem to be applied like a multiplier, slowing down the turn speed.

    Returns void

    Note

    Not affected by GetUnitTurnSpeed/SetUnitTurnSpeed.

    Note

    If duration < 0.1, while the unit is moving, calling this function will have no effect.

    Bug

    For duration == 0.5 the footman plays the running animation while turning.

    uf1 = CreateUnit(Player(0), FourCC("hfoo"), -128, 0, 90)
    uf2 = CreateUnit(Player(0), FourCC("hfoo"), 128, 0, 90)

    SetUnitFacing(uf1, -90)
    SetUnitFacingTimed(uf2, -90, 0.5)

    Bug

    For duration values other than zero, the final angle is different than the requested angle, even when called repeatedly.

    SetUnitFacing(uf1, 90)
    SetUnitFacingTimed(uf2, 90, 1) --> final angle = 96.91184 (expected 90)

Generated using TypeDoc