Vector(x, y, z).
Fields
Arithmetic
Methods
QAngle
Euler angles: pitch, yaw, roll.QAngle(pitch, yaw, roll).
Passing to entity fields
Anywhereentity.* writes a Vector or QAngle schema field, both the typed object and a plain table work:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Create and manipulate Vector and QAngle values.
Vector(x, y, z).
local v = Vector(1, 2, 3)
v.x, v.y, v.z -- 1, 2, 3 (writable)
local u = v + Vector(0, 0, 5)
local w = v * 2
local d = (v - u):Length()
v.x, v.y, v.z
v.x = 100
v + u | component-wise |
v - u | component-wise |
v * s, s * v | scale by number |
v / s | divide by number |
-v | negation |
v == u | exact equality |
v:Length() | euclidean length |
v:LengthSqr() | squared length |
v:Distance(u) | (v - u):Length() |
v:Dot(u) | dot product |
v:Cross(u) | cross product, new Vector |
v:Normalize() | unit vector, new Vector; zero-length returns Vector(0, 0, 0) |
QAngle(pitch, yaw, roll).
local a = QAngle(0, 90, 0)
a.pitch, a.yaw, a.roll -- 0, 90, 0 (writable)
entity.* writes a Vector or QAngle schema field, both the typed object and a plain table work:
pawn.m_vecOrigin = Vector(0, 0, 0)
pawn.m_vecOrigin = { x = 0, y = 0, z = 0 }
pawn.m_angEyeAngles = QAngle(0, 90, 0)
pawn.m_angEyeAngles = { pitch = 0, yaw = 90, roll = 0 }