Garry's Mod Wiki

Revision Difference

util.LocalToWorld#565524

<function name="LocalToWorld" parent="util" type="libraryfunc"> <description>Returns a vector in world coordinates based on an entity and local coordinates</description>⤶ <realm>Shared and Menu</realm>⤶ <description>⤶ A convenience function around LocalToWorld-related functions.⤶ ⤶ <note>If <page>Entity:EntIndex</page> returns `0`, the function will return the passed `lpos`.</note>⤶ </description>⤶ <realm>Shared</realm>⤶ <file line="76-L95">lua/includes/extensions/util.lua</file> <args> <arg name="ent" type="Entity">The entity lpos is local to</arg>⤶ <arg name="lpos" type="Vector">Coordinates local to the ent</arg>⤶ <arg name="bonenum" type="number">The bonenumber of the ent lpos is local to</arg>⤶ <arg name="ent" type="Entity">The entity to take.</arg>⤶ <arg name="lpos" type="Vector">A local space vector.</arg>⤶ <arg name="bone" type="number" default="0">⤶ Actually to be treated as the number corresponding to a specific <page>PhysObj</page> of the entity.⤶ ⤶ If that specific physics object is valid, then <page>PhysObj:LocalToWorld</page> is used.⤶ ⤶ Otherwise, <page>Entity:LocalToWorld</page>.⤶ </arg>⤶ </args> <rets> <ret name="" type="Vector">wpos</ret>⤶ <ret name="" type="Vector">The correspondent worldspace vector.</ret>⤶ </rets> </function>