Entity/GetPos

From Garry's Mod
Revision as of 21:53, 13 May 2016 by Robotboy655 (Talk | contribs)
Jump to: navigation, search
 Entity:GetPos( )

Contents

Description

Gets the position of entity in world.

Returns

Vector

The position of the entity.

Examples

Example

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

concommand.Add( "entity_pos", function( ply )
	local ply:GetEyeTrace()
	if ( IsValid( tr.Entity ) ) then
		print( "Entity position:", tr.Entity:GetPos() )
	else
		print( "Crosshair position:", tr.HitPos )
	end
end )


Personal tools
Navigation