Difference between revisions of "GetEntityPosition"

From Nomad DB
Line 8: Line 8:
 
* [[EntityId]]
 
* [[EntityId]]
 
* '''index''' (number) 0 for x, 1 for y, 2 for z
 
* '''index''' (number) 0 for x, 1 for y, 2 for z
 +
* '''Returns: position component''' (number/float)
  
 
== Example ==
 
== Example ==

Revision as of 18:48, 14 April 2020

Retrieves a position from an Entity.

Syntax

GetEntityPosition(EntityId, index)
  • EntityId
  • index (number) 0 for x, 1 for y, 2 for z
  • Returns: position component (number/float)

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