public virtual void UpdateAnchorFromPlugin() { XDevicePlugin.GetObject(m_Handle, XDevicePlugin.kField_TRSObject, m_UpdateAnchorFromPluginTRS, 0); if (true) { anchor.localPosition = new Vector3( m_UpdateAnchorFromPluginTRS[0], m_UpdateAnchorFromPluginTRS[1], -m_UpdateAnchorFromPluginTRS[2] ); anchor.localRotation = new Quaternion( -m_UpdateAnchorFromPluginTRS[3], -m_UpdateAnchorFromPluginTRS[4], m_UpdateAnchorFromPluginTRS[5], m_UpdateAnchorFromPluginTRS[6] ); // if (makeTrackerForward) { if (trackingSpace != null) { trackingSpace.localRotation = Quaternion.Euler(0.0f, -(anchor.localRotation.eulerAngles.y + 180.0f), 0.0f); } } } }
/// <summary> /// Gets marker tracking state, if marker is not tracked, return false. /// If tracked, out tracked raw position + rotation. /// SubMarkerMask : the bitmask of sub markers. Each submark takes 1 bit. /// </summary> /// <returns><c>true</c>, if marker state was gotten, <c>false</c> otherwise.</returns> /// <param name="markerID">Marker I.</param> /// <param name="rawPos">Raw position.</param> /// <param name="rawRotation">Raw rotation.</param> /// <param name="SubMarkerMask">Sub marker mask.</param> internal static bool GetMarkerState(int markerID, out Vector3 rawPos, out Quaternion rawRotation, out ulong SubMarkerMask) { if (IsSupported) { XDevicePlugin.XAttrTrackingInfo marker_info = new XDevicePlugin.XAttrTrackingInfo(0, markerID); XDevicePlugin.GetObject(DevicerHandle.HmdHandle, XDevicePlugin.XVpuAttributes.kXVpuAttr_Obj_TrackingInfo, ref marker_info); // XDevicePlugin.DoAction(DevicerHandle.HmdHandle, XDevicePlugin.XActions.kXAct_GetMarkerInfo, ref marker_info); rawPos = Vector3.zero; rawRotation = Quaternion.identity; SubMarkerMask = 0; if (marker_info.state == (int)TrackingResult.PoseTracked) { var XYZIndex = RawPositionindex; var QIndex = RawRotationIndex; var XYZMul = RawPositionFieldMultiplier; var QMul = RawRotationFieldMultiplier; rawPos = new Vector3( marker_info.position[XYZIndex.x] * XYZMul.x, marker_info.position[XYZIndex.y] * XYZMul.y, marker_info.position[XYZIndex.z] * XYZMul.z); rawRotation = MarkerPosePreTilt * new Quaternion( marker_info.rotation[QIndex.x] * QMul.x, marker_info.rotation[QIndex.y] * QMul.y, marker_info.rotation[QIndex.z] * QMul.z, marker_info.rotation[QIndex.w] * QMul.w) * MarkerPosePostTilt; SubMarkerMask = marker_info.recognized_markers_mask; return(true); } else { return(false); } } else { rawPos = Vector3.zero; rawRotation = Quaternion.identity; SubMarkerMask = 0; return(false); } }
public virtual void UpdateAnchorFromPlugin() { XDevicePlugin.GetObject(m_Handle, XDevicePlugin.kField_TRS, m_UpdateAnchorFromPluginTRS, 0); if (true) { anchor.localPosition = new Vector3( m_UpdateAnchorFromPluginTRS[0], m_UpdateAnchorFromPluginTRS[1], -m_UpdateAnchorFromPluginTRS[2] ); anchor.localRotation = new Quaternion( -m_UpdateAnchorFromPluginTRS[3], -m_UpdateAnchorFromPluginTRS[4], m_UpdateAnchorFromPluginTRS[5], m_UpdateAnchorFromPluginTRS[6] ); } }