Garry's Mod Wiki

Garry's Mod Wiki

  Vector Entity:GetPos()

Description

Gets the position of given entity in the world.

See Entity:GetLocalPos for the position relative to the entity's Entity:GetParent.

Returns

1 Vector
The position of the entity.

Example

Utility command that would give you the position of the entity you are looking at.

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 )

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...