目录

GetPosture

获取当前控制器的位置向量、跟踪状态和旋转四元数(获取位置向量暂不支持)。

Parameter

Parameter Name

Parameter Type

Description

pose

Posture

For details, see section 2.1.3.3 "Posture"

将当前控制器的旋转四元数(x,y,z,w)写入 pose.rotation

将当前控制器的位置向量(x,y,z)写入 pose.position

将当前控制器的跟踪状态(Tracking或Untracking)写入 pose.trackStatus

Return Values

调用函数成功返回0,失败返回-1。

Examples

if (null == controller) {
    Debug.LogError("Controller is null");
} else {
    Posture pos = new Posture();
    int ret = controller.GetPosture(ref pos);
    if (ret == 0) {
        Quaternion quatDat;
        Vector3 posDat;
        quatDat = pos.rotation; //Obtain the rotation posture of a controller.
        posDat = pos.position; //Obtain the controller position.
    } else {
        Debug.Log("Get controller posture failed!");
    }
}