Garry's Mod Wiki

Revision Difference


<function name="GetPos" parent="Entity" type="classfunc">⤶ <description>Gets the position of entity in world.</description>⤶ <realm>Shared</realm>⤶ <rets>⤶ <ret name="" type="Vector">The position of the entity.</ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>Utility command that would give you the position of the entity you are looking at.</description>⤶ <code>⤶ concommand.Add( "entity_pos", function( ply )⤶ local tr = ply:GetEyeTrace()⤶ if ( IsValid( tr.Entity ) ) then⤶ print( "Entity position:", tr.Entity:GetPos() )⤶ else⤶ print( "Crosshair position:", tr.HitPos )⤶ end⤶ end )⤶ </code>⤶ ⤶ </example>