示例#1
0
 private void Update()
 {
     if (_positionBuffer.GetNextItem(Vector3.Lerp, Time.deltaTime, out _position))
     {
         _rigidBody.MovePosition(_position);
     }
 }
示例#2
0
        private void Update()
        {
            Vector3 previousPosition = _playerRigidBody.position;

            if (_positionBuffer.GetNextItem(Vector3.Lerp, Time.deltaTime, out _position))
            {
                _playerRigidBody.MovePosition(_position);
            }
            if (_rotationBuffer.GetNextItem(Quaternion.Lerp, Time.deltaTime, out _rotation))
            {
                _playerRigidBody.MoveRotation(_rotation.normalized);
            }

            bool walking = Math.Abs(_position.x - previousPosition.x) > 0.01 ||
                           Math.Abs(_position.z - previousPosition.z) > 0.01;

            _anim.SetBool("IsWalking", walking);
        }