Regular API function

simGetObjectQuaternion / sim.getObjectQuaternion

Description Retrieves the quaternion (x,y,z,w) of an object. See also the other matrix/transformation functions.
C synopsis simInt simGetObjectQuaternion(simInt objectHandle,simInt relativeToObjectHandle,simFloat* quaternion)
C parameters
objectHandle: handle of the object. Combine with sim.handleflag_wxyzquaternion to retrieve the quaternion as (w,x,y,z) order instead of (x,y,z,w) order. Can also be combined with sim.handleflag_reljointbaseframe (see next argument)
relativeToObjectHandle: indicates relative to which reference frame we want the orientation. Specify -1 to retrieve the absolute orientation, sim.handle_parent to retrieve the orientation relative to the object's parent, or an object handle relative to whose reference frame you want the orientation. If this handle is the handle of a joint, then the quaternion relative to the joint's moving frame will be returned (unless objectHandle is combined with sim.handleflag_reljointbaseframe, in which case the quaternion relative to the joint's base frame will be returned).
quaternion: the quaternion (x,y,z,w)
C return value
-1 if operation was not successful
Lua synopsis table[4] quaternion=sim.getObjectQuaternion(int objectHandle,int relativeToObjectHandle)
Lua parameters
Similar to the C-function counterpart
Lua return values
Similar to the C-function counterpart
Remote API equiv.
Legacy remote API: simxGetObjectQuaternion