Beispiel #1
0
        void updatePose(InteractionSourcePose pose)
        {
            Vector3    angularVelocity, gripPosition, pointerPosition, pointerForward, gripForward;
            Quaternion gripRotation, pointerRotation;

            if (pose.TryGetPosition(out gripPosition, InteractionSourceNode.Grip))
            {
                _currentState.GripPosition = gripPosition;
            }

            if (pose.TryGetPosition(out pointerPosition, InteractionSourceNode.Pointer))
            {
                _currentState.PointerPosition = pointerPosition;
            }

            if (pose.TryGetRotation(out pointerRotation, InteractionSourceNode.Pointer))
            {
                _currentState.PointerRotation = pointerRotation;
            }


            if (pose.TryGetRotation(out gripRotation, InteractionSourceNode.Grip))
            {
                _currentState.GripRotation = gripRotation;
            }

            if (pose.TryGetForward(out pointerForward, InteractionSourceNode.Pointer))
            {
                _currentState.PointerForward = pointerForward;
            }

            if (pose.TryGetAngularVelocity(out angularVelocity))
            {
                _currentState.AngularVelocity = angularVelocity;
            }
        }
        protected virtual void UpdateControllerPose(InteractionSourcePose pose)
        {
            Quaternion newRotation;

            if (pose.TryGetRotation(out newRotation, InteractionSourceNode.Grip))
            {
                transform.localRotation = newRotation;
            }

            Vector3 newPosition;

            if (pose.TryGetPosition(out newPosition, InteractionSourceNode.Grip))
            {
                transform.localPosition = newPosition;
            }
        }