void Start()
        {
            _anim = GetComponent <Animator>();
            _ik   = GetComponent <ClimbIK>();
            SetCurveReference();

            transform.parent = null;
        }
        public LerpIK(ClimbIK ikController, AvatarIKGoal ik, Point targetPoint, float waitTime)
        {
            this.ik           = ik;
            this.targetPoint  = targetPoint;
            this._waitTime    = waitTime;
            this.ikController = ikController;

            _startPos = ikController.GetCurrentPointPosition(ik);
        }
Exemple #3
0
 void Start()
 {
     input          = FindObjectOfType <PlayerInput>();
     anim           = GetComponentInChildren <Animator>();
     mc             = GetComponent <PlayerController>();
     ik             = GetComponentInChildren <ClimbIK>();
     am             = FindObjectOfType <AudioManager>();
     modelTransform = GameObject.Find("PlayerModel").transform;
     transitionHint = GameObject.Find("GP_TransitionHint").GetComponent <Text>();
     SetCurveReferences();
 }
        void InitIK(Vector3 directionToPoint, bool opposite)
        {
            Vector3 relativeDirection = transform.InverseTransformDirection(directionToPoint);

            if (Mathf.Abs(relativeDirection.y) > 0.5f)
            {
                float targetAnim = 0;

                if (_targetState == ClimbState.onPoint)
                {
                    _ikLanding = ClimbIK.GetOppositeIK(_ikLanding);
                }
                else
                {
                    if (Mathf.Abs(relativeDirection.x) > 0)
                    {
                        if (relativeDirection.x < 0)
                        {
                            _ikLanding = AvatarIKGoal.LeftHand;
                        }
                        else
                        {
                            _ikLanding = AvatarIKGoal.RightHand;
                        }
                    }

                    targetAnim = _ikLanding == AvatarIKGoal.RightHand ? 1 : 0;
                    if (relativeDirection.y < 0)
                    {
                        targetAnim = _ikLanding == AvatarIKGoal.RightHand ? 0 : 1;
                    }

                    _anim.SetFloat("Movement", targetAnim);
                }
            }
            else
            {
                _ikLanding = relativeDirection.x < 0 ? AvatarIKGoal.LeftHand : AvatarIKGoal.RightHand;
                if (opposite)
                {
                    _ikLanding = ClimbIK.GetOppositeIK(_ikLanding);
                }
            }

            _ikT = 0;
            UpdateIKTarget(0, _ikLanding, _targetPoint);

            _ikFollowing = ClimbIK.GetOppositeLimb(_ikLanding);
            _fikT        = 0;
            UpdateIKTarget(1, _ikFollowing, _targetPoint);
        }
        void InitIKDirect(Vector3 directionToPoint)
        {
            var delayedSide = AvatarIKGoal.LeftHand;

            if (directionToPoint.x < 0)
            {
                delayedSide = AvatarIKGoal.RightHand;
            }
            var instantSide = ClimbIK.GetOppositeIK(delayedSide);

            _ik.UpdateAllPointsOnOne(_targetPoint);


            _ik.UpdateTargetPosition(instantSide, _targetPoint.GetIK(instantSide).target.transform.position);
            _ik.UpdateTargetPosition(ClimbIK.GetOppositeLimb(instantSide), _targetPoint.GetIK(ClimbIK.GetOppositeLimb(instantSide)).target.transform.position);
        }
 void InitIKOpposite()
 {
     //UpdateIKTarget(2, ClimbIK.GetOppositeIK(_ikLanding), _curPoint);
     UpdateIKTarget(3, ClimbIK.GetOppositeIK(_ikFollowing), _targetPoint);
 }