Regular API function

simGetObjectMatrix / sim.getObjectMatrix

Description Retrieves the transformation matrix of an object. See also the other matrix/transformation functions.
C synopsis simInt simGetObjectMatrix(simInt objectHandle,simInt relativeToObjectHandle,simFloat* matrix)
C parameters
objectHandle: handle of the object. Can be combined with sim_handleflag_reljointbaseframe (see next argument)
relativeToObjectHandle: indicates relative to which reference frame we want the matrix. Specify -1 to retrieve the absolute transformation matrix, sim_handle_parent to retrieve the transformation matrix relative to the object's parent, or an object handle relative to whose reference frame we want the transformation matrix. If this handle is the handle of a joint, then the matrix relative to the joint's moving frame will be returned (unless objectHandle is combined with sim_handleflag_reljointbaseframe, in which case the matrix relative to the joint's base frame will be returned).
matrix: pointer to 12 simFloat values (the last row of the 4x4 matrix (0,0,0,1) is not needed)
The x-axis of the orientation component is (matrix[0],matrix[4],matrix[8])
The y-axis of the orientation component is (matrix[1],matrix[5],matrix[9])
The z-axis of the orientation component is (matrix[2],matrix[6],matrix[10])
The translation component is (matrix[3],matrix[7],matrix[11])
C return value
-1 if operation was not successful
Lua synopsis table[12] matrix=sim.getObjectMatrix(int objectHandle,int relativeToObjectHandle)
Lua parameters
objectHandle: handle of the object. Can be combined with sim.handleflag_reljointbaseframe (see next iargument)
relativeToObjectHandle: indicates relative to which reference frame we want the matrix. Specify -1 to retrieve the absolute transformation matrix, sim.handle_parent to retrieve the transformation matrix relative to the object's parent, or an object handle relative to whose reference frame we want the transformation matrix. If this handle is the handle of a joint, then the matrix relative to the joint's moving frame will be returned (unless objectHandle is combined with sim.handleflag_reljointbaseframe, in which case the matrix relative to the joint's base frame will be returned).
Lua return values
matrix: table of 12 numbers (the last row of the 4x4 matrix (0,0,0,1) is not returned)
Remote API equiv.
B0-based remote API: simxGetObjectMatrix
Legacy remote API: -