예제 #1
0
        void LerpIKLandingSideLinear()
        {
            float speed     = speedLinear * Time.deltaTime;
            float lerpSpeed = speed / _interpolDistance;

            _ikT += lerpSpeed * 2;
            if (_ikT > 1)
            {
                _ikT = 1;
                _ikLandSideReached = true;
            }

            Vector3 ikPosition = Vector3.Lerp(_ikStartPos[0], _ikTargetPos[0], _ikT);

            _ik.UpdateTargetPosition(_ikLanding, ikPosition);

            _fikT += lerpSpeed * 2;
            if (_fikT > 1)
            {
                _fikT = 1;
                _ikFollowSideReached = true;
            }

            Vector3 followSide = Vector3.Lerp(_ikStartPos[1], _ikTargetPos[1], _fikT);

            _ik.UpdateTargetPosition(_ikFollowing, followSide);
        }
예제 #2
0
        public void Update()
        {
            if (_waitTime > 0)
            {
                _waitTime -= Time.deltaTime;
                if (_waitTime > 0)
                {
                    return;
                }
            }

            _t += Time.deltaTime;
            Vector3 targetPos = targetPoint.GetIK(ik).target.transform.position;
            Vector3 pos       = Vector3.Lerp(_startPos, targetPos, _t);

            ikController.UpdateTargetPosition(ik, pos);

            Debug.DrawLine(ikController.transform.position, targetPos, Color.red);
            Debug.DrawLine(ikController.transform.position, pos, Color.blue);
        }