Difference between revisions of "GetEntityPosition"

From Nomad DB
Line 7: Line 7:
  
 
* '''entityID''' (string): [[EntityId|ID]] of the target entity
 
* '''entityID''' (string): [[EntityId|ID]] of the target entity
* '''component'' (number): Coordinate component to return (0 = x; 1 = y; 2 = z)
+
* '''component''' (number): Coordinate component to return (0 = x; 1 = y; 2 = z)
 
* '''Returns''' (number): position component
 
* '''Returns''' (number): position component
  

Revision as of 19:03, 14 April 2020

Retrieves a position from an Entity.

Syntax

GetEntityPosition(entityId, component)
  • entityID (string): ID of the target entity
  • component (number): Coordinate component to return (0 = x; 1 = y; 2 = z)
  • Returns (number): position component

Example

local lplayerId = GetLocalPlayerEntityId()
if lplayerId ~= GetInvalidEntityId() then
	local x = GetEntityPosition(lplayerId, 0)
	local y = GetEntityPosition(lplayerId, 0)
	local z = GetEntityPosition(lplayerId, 0)
	
	print("Position: ", x, y, z)
end

Related Pages