Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Vector3 inputDirection = new Vector3(_input.move.x, 0.0f, _input.move.y).normalized;
- if (_input.move != Vector2.zero)
- {
- _targetRotation = Mathf.Atan2(inputDirection.x, inputDirection.z) * Mathf.Rad2Deg + _playerCamera.transform.eulerAngles.y;
- float rotation = Mathf.SmoothDampAngle(transform.eulerAngles.y, _targetRotation, ref _rotationVelocity, RotationSmoothTime);
- transform.rotation = Quaternion.Euler(0.0f, rotation, 0.0f);
- }
- Vector3 direction = Quaternion.Euler(0.0f, _targetRotation, 0.0f) * Vector3.forward;
- _controller.Move(direction.normalized * (_speed * Time.deltaTime) + new Vector3(0.0f, _verticalVelocity, 0.0f) * Time.deltaTime);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement