Skip to content

GetPlayerYaw

The direction the player faces, in degrees.

The game’s convention: 0 faces +Y, 90 faces -X, 180 faces -Y, 270 faces +X - counter-clockwise seen from above.

GetPlayerYaw(pid)
Parameter Type
pid number the player

number - degrees 0..360; 0 when not connected

-- two metres in front of the player
local x, y, z = GetPlayerPos(pid)
local r = math.rad(GetPlayerYaw(pid))
local fx, fy = x - math.sin(r) * 2, y + math.cos(r) * 2

GetPlayerPos · SetPlayerPos · the Players group of the index