private Vector3 PollVInput(Node node, OVRPlugin.Node ovrNode, NodeStatePropertyType type) { Vector3 value; OVRNodeStateProperties.GetNodeStatePropertyVector3(node, type, ovrNode, OVRPlugin.Step.Render, out value); return(value); }
private Quaternion PollQInput(Node node, OVRPlugin.Node ovrNode, NodeStatePropertyType type) { Quaternion value; OVRNodeStateProperties.GetNodeStatePropertyQuaternion(node, type, ovrNode, OVRPlugin.Step.Render, out value); return(value); }
public static bool GetNodeStatePropertyQuaternion(Node nodeType, NodeStatePropertyType propertyType, OVRPlugin.Node ovrpNodeType, OVRPlugin.Step stepType, out Quaternion retQuat) { retQuat = Quaternion.identity; switch (propertyType) { case NodeStatePropertyType.Orientation: if (OVRManager.loadedXRDevice == OVRManager.XRDevice.Oculus) { retQuat = OVRPlugin.GetNodePose(ovrpNodeType, stepType).ToOVRPose().orientation; return(true); } #if UNITY_2017_1_OR_NEWER if (GetUnityXRNodeStateQuaternion(nodeType, NodeStatePropertyType.Orientation, out retQuat)) { return(true); } #endif break; } return(false); }
public static bool GetNodeStatePropertyVector3(Node nodeType, NodeStatePropertyType propertyType, OVRPlugin.Node ovrpNodeType, OVRPlugin.Step stepType, out Vector3 retVec) { retVec = Vector3.zero; switch (propertyType) { case NodeStatePropertyType.Acceleration: if (OVRManager.loadedXRDevice == OVRManager.XRDevice.Oculus) { retVec = OVRPlugin.GetNodeAcceleration(ovrpNodeType, stepType).FromFlippedZVector3f(); return(true); } #if UNITY_2017_1_OR_NEWER if (GetUnityXRNodeStateVector3(nodeType, NodeStatePropertyType.Acceleration, out retVec)) { return(true); } #endif break; case NodeStatePropertyType.AngularAcceleration: if (OVRManager.loadedXRDevice == OVRManager.XRDevice.Oculus) { retVec = OVRPlugin.GetNodeAngularAcceleration(ovrpNodeType, stepType).FromFlippedZVector3f(); return(true); } #if UNITY_2017_2_OR_NEWER if (GetUnityXRNodeStateVector3(nodeType, NodeStatePropertyType.AngularAcceleration, out retVec)) { return(true); } #endif break; case NodeStatePropertyType.Velocity: if (OVRManager.loadedXRDevice == OVRManager.XRDevice.Oculus) { retVec = OVRPlugin.GetNodeVelocity(ovrpNodeType, stepType).FromFlippedZVector3f(); return(true); } #if UNITY_2017_1_OR_NEWER if (GetUnityXRNodeStateVector3(nodeType, NodeStatePropertyType.Velocity, out retVec)) { return(true); } #endif break; case NodeStatePropertyType.AngularVelocity: if (OVRManager.loadedXRDevice == OVRManager.XRDevice.Oculus) { retVec = OVRPlugin.GetNodeAngularVelocity(ovrpNodeType, stepType).FromFlippedZVector3f(); return(true); } #if UNITY_2017_2_OR_NEWER if (GetUnityXRNodeStateVector3(nodeType, NodeStatePropertyType.AngularVelocity, out retVec)) { return(true); } #endif break; case NodeStatePropertyType.Position: if (OVRManager.loadedXRDevice == OVRManager.XRDevice.Oculus) { retVec = OVRPlugin.GetNodePose(ovrpNodeType, stepType).ToOVRPose().position; return(true); } #if UNITY_2017_1_OR_NEWER if (GetUnityXRNodeStateVector3(nodeType, NodeStatePropertyType.Position, out retVec)) { return(true); } #endif break; } return(false); }
public static Vector3 GetNodeStateProperty(Node nodeType, NodeStatePropertyType propertyType, OVRPlugin.Node ovrpNodeType, OVRPlugin.Step stepType) { switch (propertyType) { case NodeStatePropertyType.Acceleration: #if UNITY_2017_1_OR_NEWER return(GetUnityXRNodeState(nodeType, NodeStatePropertyType.Acceleration)); #else return(OVRPlugin.GetNodeAcceleration(ovrpNodeType, stepType).FromFlippedZVector3f()); #endif case NodeStatePropertyType.AngularAcceleration: #if UNITY_2017_2_OR_NEWER return(GetUnityXRNodeState(nodeType, NodeStatePropertyType.AngularAcceleration)); #else return(OVRPlugin.GetNodeAngularAcceleration(ovrpNodeType, stepType).FromFlippedZVector3f() * Mathf.Rad2Deg); #endif case NodeStatePropertyType.Velocity: #if UNITY_2017_1_OR_NEWER return(GetUnityXRNodeState(nodeType, NodeStatePropertyType.Velocity)); #else return(OVRPlugin.GetNodeVelocity(ovrpNodeType, stepType).FromFlippedZVector3f()); #endif case NodeStatePropertyType.AngularVelocity: #if UNITY_2017_2_OR_NEWER return(GetUnityXRNodeState(nodeType, NodeStatePropertyType.AngularVelocity)); #else return(OVRPlugin.GetNodeAngularVelocity(ovrpNodeType, stepType).FromFlippedZVector3f() * Mathf.Rad2Deg); #endif } return(Vector3.zero); }