/// <summary>
        /// Updates all pose animation and blending. Can be called from different places without performance concerns, as it will only let itself run once per frame.
        /// </summary>
        public void UpdatePose(SteamVR_Action_Skeleton skeletonAction, SteamVR_Input_Sources inputSource)
        {
            // only allow this function to run once per frame
            if (poseUpdatedThisFrame)
            {
                return;
            }

            poseUpdatedThisFrame = true;

            if (skeletonAction.activeBinding)
            {
                // always do additive animation on main pose
                blendPoses[0].UpdateAdditiveAnimation(skeletonAction, inputSource);
            }

            //copy from main pose as a base
            SteamVR_Skeleton_PoseSnapshot snap = GetHandSnapshot(inputSource);

            snap.CopyFrom(blendPoses[0].GetHandSnapshot(inputSource));

            ApplyBlenderBehaviours(skeletonAction, inputSource, snap);


            if (inputSource == SteamVR_Input_Sources.RightHand)
            {
                blendedSnapshotR = snap;
            }
            if (inputSource == SteamVR_Input_Sources.LeftHand)
            {
                blendedSnapshotL = snap;
            }
        }
        protected virtual void UpdateSkeleton()
        {
            if (skeletonAction == null)
            {
                return;
            }

            if (updatePose)
            {
                UpdatePose();
            }

            if (blendPoser != null && skeletonBlend < 1)
            {
                if (blendSnapshot == null)
                {
                    blendSnapshot = blendPoser.GetBlendedPose(this);
                }
                blendSnapshot.CopyFrom(blendPoser.GetBlendedPose(this));
            }

            if (rangeOfMotionBlendRoutine == null)
            {
                if (temporaryRangeOfMotion != null)
                {
                    skeletonAction.SetRangeOfMotion(temporaryRangeOfMotion.Value);
                }
                else
                {
                    skeletonAction.SetRangeOfMotion(rangeOfMotion); //this may be a frame behind
                }
                UpdateSkeletonTransforms();
            }
        }
Beispiel #3
0
        /// <summary>
        /// Updates all pose animation and blending. Can be called from different places without performance concerns, as it will only let itself run once per frame.
        /// </summary>
        public void UpdatePose(SteamVR_Action_Skeleton skeletonAction, SteamVR_Input_Sources inputSource)
        {
            // only allow this function to run once per frame
            if (poseUpdatedThisFrame)
            {
                return;
            }

            poseUpdatedThisFrame = true;

            if (skeletonAction.activeBinding)
            {
                // always do additive animation on main pose
                blendPoses[0].UpdateAdditiveAnimation(skeletonAction, inputSource);
            }

            //copy from main pose as a base
            SteamVR_Skeleton_PoseSnapshot snap = GetHandSnapshot(inputSource);

            snap.CopyFrom(blendPoses[0].GetHandSnapshot(inputSource));

            ApplyBlenderBehaviours(skeletonAction, inputSource, snap);


            if (inputSource == SteamVR_Input_Sources.RightHand)
            {
                blendedSnapshotR = snap;
            }
            if (inputSource == SteamVR_Input_Sources.LeftHand)
            {
                blendedSnapshotL = snap;
            }

            // ebaender - adjust rotation to cover angle
            if (coverMapping != null && pageMapping != null)
            {
                blendedSnapshotL.rotation *= Quaternion.Euler(0f, (177f / 180f - coverMapping.value) * 200f * pageMapping.value, 0f);
                // Debug.Log((177f / 180f - coverMapping.value) * 200f * pageMapping.value);
            }
        }