Skip to content

GetObjectFacing

The GetObjectFacing function retrieves the facing direction of a specified object in the game world. The facing direction is returned in radians, which indicates the direction the object is currently facing.

Parameters

  • object: The object identifier (GUID) or unit identifier (such as "player", "target", "focus", etc.) for which to retrieve the facing direction.

Returns

  • facing: The facing direction of the specified object in radians.

Example Usage in Lua

Here is an example of how to use the GetObjectFacing function in Lua:

local api = ...

-- Function to print the facing direction of the player
function PrintPlayerFacing()
    local player = "player"
    local facing = api.GetObjectFacing(player)
    print("Player is facing: " .. facing .. " radians")
end

-- Call the function
PrintPlayerFacing()