Garry's Mod Wiki

Revision Difference

PhysObj:LocalToWorld#565522

<function name="LocalToWorld" parent="PhysObj" type="classfunc"> <description> Translates a vector in the local space of the physics object into worldspace coordinates. <note>Internally transforms the vector by the `PhysObj:GetPositionMatrix()`'s rotation & translation. So in GLua it would approximate to: So in GLua it approximates to: ``` local matrix = PhysObj:GetPositionMatrix() local vecResult = Vector() vecResult:Set( vecLocal ) vecResult:Mul( matrix ) local matrixWorldTransform = PhysObj:GetPositionMatrix() local vecWorldspaced = Vector() vecWorldspaced:Set( vecLocal ) vecWorldspaced:Mul( matrixWorldTransform ) ⤶ return vecWorldspaced⤶ ``` </note> </description> <realm>Shared</realm> <args> <arg name="vecLocal" type="Vector">A vector in the physics object's local space</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 worldspace coordinates</ret>⤶ <ret name="" type="Vector">The corresponding vector in worldspace coordinates.</ret>⤶ </rets> </function>