Example #1
0
        private void Update()
        {
            UpdateCapTouchStates();

            m_pointBlend    = InputValueRateChange(m_isPointing, m_pointBlend);
            m_thumbsUpBlend = InputValueRateChange(m_isGivingThumbsUp, m_thumbsUpBlend);

            InputManagerVR.AxisCode aFlex = _isLeft ? InputManagerVR.AxisCode.LeftGrip : InputManagerVR.AxisCode.RightGrip;
            //float flex = InputManagerVR.GetAxis(aFlex);
            //float flex = InputManager.GetAxis("flex");

            //bool collisionEnabled = m_grabber.grabbedObject == null && flex >= THRESH_COLLISION_FLEX;
            //CollisionEnable(collisionEnabled);
            CollisionEnable(false);

            UpdateAnimStates();
        }
Example #2
0
        private void UpdateAnimStates()
        {
            bool     grabbing = false;
            HandPose grabPose = m_defaultGrabPose;
            //if (grabbing)
            //{
            //    HandPose customPose = m_grabber.grabbedObject.GetComponent<HandPose>();
            //    if (customPose != null) grabPose = customPose;
            //}
            // Pose
            HandPoseId handPoseId = grabPose.PoseId;

            m_animator.SetInteger(m_animParamIndexPose, (int)handPoseId);

            // Flex
            // blend between open hand and fully closed fist
            InputManagerVR.AxisCode aFlex = _isLeft ? InputManagerVR.AxisCode.LeftGrip : InputManagerVR.AxisCode.RightGrip;
            float flex = InputManagerVR.GetAxis(aFlex);

            //float flex = InputManager.GetAxis("flex");
            m_animator.SetFloat(m_animParamIndexFlex, flex);

            // Point
            bool  canPoint = !grabbing || grabPose.AllowPointing;
            float point    = canPoint ? m_pointBlend : 0.0f;

            m_animator.SetLayerWeight(m_animLayerIndexPoint, point);

            // Thumbs up
            bool  canThumbsUp = !grabbing || grabPose.AllowThumbsUp;
            float thumbsUp    = canThumbsUp ? m_thumbsUpBlend : 0.0f;

            m_animator.SetLayerWeight(m_animLayerIndexThumb, thumbsUp);

            InputManagerVR.AxisCode aPinch = _isLeft ? InputManagerVR.AxisCode.LeftTrigger : InputManagerVR.AxisCode.RightTrigger;
            float pinch = InputManagerVR.GetAxis(aPinch);

            //float pinch = InputManager.GetAxis("pinch");
            m_animator.SetFloat("Pinch", pinch);
        }