コード例 #1
0
 public virtual void ActivateScene(string sceneName, bool disableCameras = true)
 {
     if (!_loadedScenes.TryGetValue(sceneName, out SceneData sceneData) || sceneData._state != SceneState.Unloading)
     {
         StartCoroutine(CoActivateScene(sceneName, disableCameras));
     }
     else
     {
         QuickVRManager.LogWarning(sceneName + " cannot be the Active scene because it is " + SceneState.Unloading);
     }
 }
コード例 #2
0
        public QuickTransformAnimationCurve(ref List <Vector3> positions, ref List <Quaternion> rotations, ref List <float> timeStamps)
        {
            if (positions.Count != timeStamps.Count || rotations.Count != timeStamps.Count)
            {
                QuickVRManager.LogWarning("Lists of positions, rotations and timeStamps have different size");
                return;
            }

            for (int i = 0; i < timeStamps.Count; i++) // for every captured keyframe
            {
                AddPosition(timeStamps[i], positions[i]);
                AddRotation(timeStamps[i], rotations[i]);
            }
        }
コード例 #3
0
 protected virtual void LoadSceneAdditive(string sceneName, bool allowSceneActivation, bool isAsync)
 {
     //We can only Load a scene if it has not yet been loaded, or it is is preloaded
     if (
         !_loadedScenes.TryGetValue(sceneName, out SceneData sceneData) ||
         allowSceneActivation && (sceneData._state == SceneState.Loading || sceneData._state == SceneState.Preloaded)
         )
     {
         StartCoroutine(CoLoadSceneAdditive(sceneName, allowSceneActivation, isAsync));
     }
     else
     {
         QuickVRManager.LogWarning(sceneName + " is already " + SceneState.Loaded + ". Please, unload it first");
     }
 }
コード例 #4
0
        public virtual void Calibrate()
        {
            //POSSIBLE TRACKER CONFIGURATIONS

            //1     ->  Head
            //3     ->  Head + Hands
            //4     ->  Head + Hands + Hips
            //6     ->  Head + Hands + Hips + Feet
            //10    ->  Head + Hands + Hips + Feet + Elbows + Knees

            _isHandsSwaped = false;
            List <InputDevice> bodyTrackers = GetBodyTrackers();
            int numTrackers = bodyTrackers.Count;

            QuickVRManager.Log("NUM BODY TRACKERS = " + numTrackers);

            //Try to assign the default nodes for Head and Hands
            QuickVRNode nodeHMD       = GetVRNode(HumanBodyBones.Head);
            QuickVRNode nodeLeftHand  = GetVRNode(HumanBodyBones.LeftHand);
            QuickVRNode nodeRightHand = GetVRNode(HumanBodyBones.RightHand);

            nodeHMD._inputDevice       = InputDevices.GetDeviceAtXRNode(XRNode.Head);
            nodeLeftHand._inputDevice  = InputDevices.GetDeviceAtXRNode(XRNode.LeftHand);
            nodeRightHand._inputDevice = InputDevices.GetDeviceAtXRNode(XRNode.RightHand);

            if (numTrackers == 1 || numTrackers == 3 || numTrackers == 4 || numTrackers == 6 || numTrackers == 10)
            {
                if (!nodeHMD._inputDevice.isValid)
                {
                    //The head will always be the upper body tracker
                    nodeHMD._inputDevice = bodyTrackers[0];
                }

                if (numTrackers == 3)
                {
                    //Head + Hands
                    if (!nodeLeftHand._inputDevice.isValid)
                    {
                        nodeLeftHand._inputDevice = bodyTrackers[1];
                    }
                    if (!nodeRightHand._inputDevice.isValid)
                    {
                        nodeRightHand._inputDevice = bodyTrackers[2];
                    }
                }
                //else if (numTrackers == 4)
                //{
                //    //Head + Hands + Hips
                //    //1) Remove the head node from the list
                //    bodyTrackers.RemoveAt(0);

                //    //2) The hips is the node that is "in the middle", i.e., the hands are in opposite sides of the hips node.
                //    InitHipsAndHands(bodyTrackers);
                //}
                //else if (numTrackers == 6)
                //{
                //    //Head + Hands + Hips + Feet
                //    //1) The Feet are the trackers with the lower y
                //    InitVRNode(HumanBodyBones.LeftFoot, bodyTrackers[5]);
                //    InitVRNode(HumanBodyBones.RightFoot, bodyTrackers[4]);

                //    //2) Remove the unnecessary nodes and proceed as in the previous case
                //    bodyTrackers.RemoveAt(5);
                //    bodyTrackers.RemoveAt(4);
                //    bodyTrackers.RemoveAt(0);

                //    InitHipsAndHands(bodyTrackers);
                //}

                //UpdateVRNodes();

                //IsVRNodesSwaped(HumanBodyBones.LeftFoot, HumanBodyBones.RightFoot);
            }
            else
            {
                QuickVRManager.LogWarning("BAD NUMBER OF BODY TRACKERS!!!");
            }

            UpdateVRNodes();
            _isHandsSwaped = IsVRNodesSwaped(HumanBodyBones.LeftHand, HumanBodyBones.RightHand);
            QuickVRManager.Log("handsSwaped = " + _isHandsSwaped);

            foreach (HumanBodyBones t in QuickVRNode.GetTypeList())
            {
                QuickVRNode n = GetVRNode(t);
                if (n)
                {
                    n.Calibrate();
                }
            }
        }