private void Update() { if (_positionBuffer.GetNextItem(Vector3.Lerp, Time.deltaTime, out _position)) { _rigidBody.MovePosition(_position); } }
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); }