示例#1
0
        public QuickIKAnimationCurve(ref List <Vector3> positions, ref List <Vector3> forwards, ref List <float> timeStamps)
        {
            if (positions.Count != timeStamps.Count || forwards.Count != timeStamps.Count)
            {
                QuickVRManager.LogError("Lists of positions, rotations and timeStamps have different size");
                return;
            }

            _positionXCurve = new AnimationCurve();
            _positionYCurve = new AnimationCurve();
            _positionZCurve = new AnimationCurve();

            _forwardXCurve = new AnimationCurve();
            _forwardYCurve = new AnimationCurve();
            _forwardZCurve = new AnimationCurve();

            for (int i = 0; i < timeStamps.Count; i++) // for every captured keyframe
            {
                _positionXCurve.AddKey(timeStamps[i], positions[i].x);
                _positionYCurve.AddKey(timeStamps[i], positions[i].y);
                _positionZCurve.AddKey(timeStamps[i], positions[i].z);

                _forwardXCurve.AddKey(timeStamps[i], forwards[i].x);
                _forwardYCurve.AddKey(timeStamps[i], forwards[i].y);
                _forwardZCurve.AddKey(timeStamps[i], forwards[i].z);
            }
        }
示例#2
0
        public static Mesh GetUnityPrimitiveMesh(PrimitiveType primitiveType)
        {
            Mesh primMesh = Resources.GetBuiltinResource <Mesh>(GetPrimitiveMeshPath(primitiveType));

            if (primMesh == null)
            {
                QuickVRManager.LogError("Couldn't load Unity Primitive Mesh: " + primitiveType);
            }

            return(primMesh);
        }
示例#3
0
        public static bool Invoke(object obj, string methodName, object[] parameters = null)
        {
            System.Reflection.MethodInfo m = obj.GetType().GetMethod(methodName);
            if (m != null)
            {
                m.Invoke(obj, parameters);
            }
            else
            {
                QuickVRManager.LogError("Invoke failed!!! The method " + methodName + " does not exist on class " + obj.GetType().FullName);
            }

            return(m != null);
        }
        protected virtual void Start()
        {
            StartPlayer();

            if (_hTracking)
            {
                QuickSingletonManager.GetInstance <CameraFade>().SetColor(Color.black);
                StartCoroutine(CoUpdate());
            }
            else
            {
                QuickVRManager.LogError("NO HEAD TRACKING FOUND!!! APPLICATION IS CLOSED");
                QuickUtils.CloseApplication();
            }
        }
示例#5
0
        protected virtual void InitHipsAndHands(List <XRNodeState> bodyTrackers)
        {
            if (bodyTrackers.Count != 3)
            {
                QuickVRManager.LogError("BODY TRACKERS LIST MUST CONTAIN EXACTLY 3 ELEMENTS");
                return;
            }

            Vector3 pos0;
            Vector3 pos1;
            Vector3 pos2;

            bodyTrackers[0].TryGetPosition(out pos0);
            bodyTrackers[1].TryGetPosition(out pos1);
            bodyTrackers[2].TryGetPosition(out pos2);

            Vector3 scale = new Vector3(1, 0, 1);

            pos0 = Vector3.Scale(pos0, scale);
            pos1 = Vector3.Scale(pos1, scale);
            pos2 = Vector3.Scale(pos2, scale);

            if (Vector3.Dot(pos1 - pos0, pos2 - pos0) < 0)
            {
                //0 is the hips tracker
                InitVRNode(HumanBodyBones.Hips, bodyTrackers[0]);
                InitVRNode(HumanBodyBones.LeftHand, bodyTrackers[1]);
                InitVRNode(HumanBodyBones.RightHand, bodyTrackers[2]);
            }
            else if (Vector3.Dot(pos0 - pos1, pos2 - pos1) < 0)
            {
                //1 is the hips tracker
                InitVRNode(HumanBodyBones.Hips, bodyTrackers[1]);
                InitVRNode(HumanBodyBones.LeftHand, bodyTrackers[0]);
                InitVRNode(HumanBodyBones.RightHand, bodyTrackers[2]);
            }
            else
            {
                //2 is the hips tracker
                InitVRNode(HumanBodyBones.Hips, bodyTrackers[2]);
                InitVRNode(HumanBodyBones.LeftHand, bodyTrackers[0]);
                InitVRNode(HumanBodyBones.RightHand, bodyTrackers[1]);
            }
        }