Exemple #1
0
        protected void ApplyBlenderBehaviours(SteamVR_Action_Skeleton skeletonAction, HandType inputSource, SteamVR_Skeleton_PoseSnapshot snapshot)
        {
            // apply blending for each behaviour
            for (int behaviourIndex = 0; behaviourIndex < blendingBehaviours.Count; behaviourIndex++)
            {
                PoseBlendingBehaviour blending = blendingBehaviours[behaviourIndex];

                blending.Update(Time.deltaTime, inputSource, smoothSpeed);



                // if disabled or very low influence, skip for perf

                // float t = blending.targetBehaviour.influence * blending.GetValue();
                float t        = behaviourIndex == 0 ? 1 : blending.GetValue();
                bool  isManual = blending.targetBehaviour.type == SteamVR_Skeleton_PoserBehavior.PoseBlendingBehaviour.BlenderTypes.Manual;

                if ((blending.enabled || isManual || behaviourIndex == 0) && t > 0.01f)
                {
                    // if (blending.targetBehaviour.pose != 0)
                    // {
                    // update additive animation only as needed
                    blendPoses[blending.targetBehaviour.pose].UpdateAdditiveAnimation(skeletonAction, inputSource);
                    // }

                    blending.ApplyBlending(snapshot, blendPoses, inputSource, t);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Set the blending value of a blendingBehaviour. Works best on Manual type behaviours.
        /// </summary>
        // public void SetBlendingBehaviourValue(string behaviourName, float value)
        // {
        //     PoseBlendingBehaviour behaviour = blendingBehaviours.Find(b => b.targetBehaviour.name == behaviourName);
        //     if(behaviour == null)
        //     {
        //         Debug.LogError("[SteamVR] Blending Behaviour: " + behaviourName + " not found on Skeleton Poser: " + gameObject.name);
        //         return;
        //     }
        //     if(behaviour.targetBehaviour.type != SteamVR_Skeleton_PoserBehavior.PoseBlendingBehaviour.BlenderTypes.Manual)
        //     {
        //         Debug.LogWarning("[SteamVR] Blending Behaviour: " + behaviourName + " is not a manual behaviour. Its value will likely be overriden.");
        //     }
        //     behaviour.value = value;
        // }
        /// <summary>
        /// Get the blending value of a blendingBehaviour.
        /// </summary>
        public float GetBlendingBehaviourValue(string behaviourName)
        {
            PoseBlendingBehaviour behaviour = blendingBehaviours.Find(b => b.targetBehaviour.name == behaviourName);

            if (behaviour == null)
            {
                Debug.LogError("[SteamVR] Blending Behaviour: " + behaviourName + " not found on Skeleton Poser: " + gameObject.name);
                return(0);
            }
            return(behaviour.GetValue());
        }