Garry's Mod Wiki

Vector:AngleEx

  Angle Vector:AngleEx( Vector up )

Description

Returns the angle of this vector (normalized), but instead of assuming that up is Vector( 0, 0, 1 ) (Like Vector:Angle does) you can specify which direction is 'up' for the angle.

Arguments

1 Vector up
The up direction vector

Returns

1 Angle
The angle

Example

Shows usage of the function

print( Vector( 0, 0, 100 ):AngleEx( Vector( 0, 0, 0 ) ) )
Output: Angle( -90.000, -0.000, 0.000 )

Example

Use forward and up vector to produce angle. These two lines below will return the same angle

local e = ents.Create("prop_physics") print(e:GetAngles()) print(e:GetForward():AngleEx(e:GetUp()))