LocalToWorld
Description
Translates the specified position and angle from the specified local coordinate system into worldspace coordinates.
If you're working with an entity's local vectors, use Entity:LocalToWorld and/or Entity:LocalToWorldAngles instead.
See also: WorldToLocal, the reverse of this function.
Arguments
1 Vector localPos
The position vector in the source coordinate system, that should be translated to world coordinates
Returns
Example
Matrix math which showcases how this is calculated internally.
local localTransform = Matrix()
localTransform:SetTranslation(localPos)
localTransform:SetAngles(localAng)
local worldTransform = Matrix()
worldTransform:SetTranslation(originPos)
worldTransform:SetAngles(originAngle)
-- Transform the local coordinates using the world transform as a transformation matrix
local localToWorld = worldTransform * localTransform
print(localToWorld:GetTranslation(), localToWorld:GetAngles())