-
Notifications
You must be signed in to change notification settings - Fork 0
Extended: QAngle
How to get this userdata:
Angle()
QAngle()-- Using "Angle()" is same as "QAngle()".
local angle = Angle(1, 2, 3)
local pitch = angle.p -- angle.pitch also usable.
local yaw = angle.yaw
local roll = angle.r -- angle.roll also usable.The QAngle userdata now support calculating:
local angle1 = Angle(1, 2, 3)
local angle2 = Angle(4, 5, 6)
print(angle1 + angle2) -- Output: "5.000 7.000 9.000"
print(angle1 / angle2) -- Output: "0.250 0.400 0.500"
print(angle1 * angle2) -- Output: "4.000 10.000 18.000"
print(angle1 - angle2) -- Output: "-3.000 -3.000 -3.000"
print(-angle1) -- Output: "-1.000 -2.000 -3.000"
print(angle1 == angle2) -- Output: "false"tostring(angle)Format angle to a proper string "pitch yaw roll", with maximum 3 decimal places.
angle:Add(angle)Adds the values of the argument angle to the orignal angle.
This functions the same as angle1 + angle2 without creating a new angle object, skipping object construction and garbage collection.
angle: angle
angle:Div(divisor)Divides all values of the original angle by a scalar.
This functions the same as angle1 / num without creating a new angle object, skipping object construction and garbage collection.
divisor: number
angle:Forward()Returns a normal vector facing in the direction that the angle points.
Return: vector
angle:IsZero()Returns whether the pitch, yaw and roll are 0 or not.
Return: true or false
angle:Mul(multiplier)Multiplies a scalar to all the values of the orignal angle.
This functions the same as angle1 * num without creating a new angle object, skipping object construction and garbage collection.
multiplier: number
angle:Normalize(z_alwayszero)Normalizes the angles by applying a module with 360 to pitch, yaw and roll. If z_alwayszero is true, the roll will be set to 0.
z_alwayszero: bool
angle:Sub(angle)Subtracts the values of the argument angle to the orignal angle.
This functions the same as angle1 - angle2 without creating a new angle object, skipping object construction and garbage collection.
angle: angle