Garry's Mod Wiki

Revision Difference

PhysObj:LocalToWorld#565510

<function name="LocalToWorld" parent="PhysObj" type="classfunc"> <description> Mapping a vector in local frame of the physics object to world frame. ⤶ <note>this function does translation and rotation, with translation done first.</note>⤶ Remaps a vector in the local space of the physics object to worldspace coordinates. ⤶ <note>Internally transforms the vector by the `PhysObj:GetPositionMatrix()`'s rotation & translation.⤶ So in GLua it would approximate to:⤶ ```⤶ local matrix = PhysObj:GetPositionMatrix()⤶ local vecResult = Vector()⤶ vecResult:Set( vecLocal )⤶ vecResult:Mul( matrix )⤶ ```⤶ </note>⤶ </description> <realm>Shared</realm> <args> <arg name="LocalVec" type="Vector">A vector in the physics object's local frame</arg>⤶ <arg name="vecLocal" type="Vector">A vector in the physics object's local space</arg>⤶ </args> <rets> <ret name="" type="Vector">The corresponding vector in world frame</ret>⤶ <ret name="" type="Vector">The corresponding vector in worldspace coordinates</ret>⤶ </rets> </function>