Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void CameraRotation()
- {
- if (_input.look.sqrMagnitude >= _threshold && !LockCameraPosition)
- {
- float deltaTimeMultiplier = isMouse ? 1.0f : Time.deltaTime;
- _cameraTargetYaw += _input.look.x * deltaTimeMultiplier;
- _cameraTarrgetPitch += _input.look.y * deltaTimeMultiplier;
- }
- _cameraTargetYaw = ClampAngle(_cameraTargetYaw, float.MinValue, float.MaxValue);
- _cameraTarrgetPitch = ClampAngle(_cameraTarrgetPitch, BottomClamp, TopClamp);
- cameraTarget.transform.rotation = Quaternion.Euler(_cameraTarrgetPitch + CameraAngleOverride, _cameraTargetYaw, 0.0f);
- }
- private void Move()
- {
- 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