Regular API function

simGetObjectPosition / sim.getObjectPosition

Description Retrieves the position of an object. See also sim.setObjectPosition, sim.getObjectOrientation, sim.getObjectMatrix and the other matrix/transformation functions.
C synopsis simInt simGetObjectPosition(simInt objectHandle,simInt relativeToObjectHandle,simFloat* position)
C parameters
objectHandle: handle of the object
relativeToObjectHandle: indicates relative to which reference frame we want the position. Specify -1 to retrieve the absolute position, sim_handle_parent to retrieve the position relative to the object's parent, or an object handle relative to whose reference frame we want the position.
position: pointer to 3 values (x, y and z)
C return value
-1 if operation was not successful. In a future release, a more differentiated return value might be available
Lua synopsis table_3 position=sim.getObjectPosition(number objectHandle,number relativeToObjectHandle)
Lua parameters
Same as C-function
Lua return values
position: table of 3 values (x, y and z) or nil in case of an error
Remote API equiv.
Legacy remote API: simxGetObjectPosition

All regular API functions on one page