๋งˆ์šฐ์Šค ์ขŒ์šฐ๋กœ ์›€์ง์ด๋ฉด ์บ๋ฆญํ„ฐ ํšŒ์ „ํ•˜๊ณ  ์œ„์•„๋ž˜ ์›€์ง์ด๋ฉด ์นด๋ฉ”๋ผ ํšŒ์ „ ํ•˜๋ ค๋Š”๋ฐ ์ด๋ ‡๊ฒŒ ๋˜๋„ค์š”



private void Update()

{

ApplyRotation();

}


private void ApplyRotation()

{

CarachterRoatation();

CameraRotation();

}


private void CameraRotation()

{

float _cameraRotationUpDown = _mouseInput.y * mouseSensitivity.vertical;

currentCameraRotationUpDown -= _cameraRotationUpDown;

currentCameraRotationUpDown = Mathf.Clamp(currentCameraRotationUpDown, cameraAngle.min, cameraAngle.max);


_mainCamera.transform.localEulerAngles = new Vector3(currentCameraRotationUpDown, 0f, 0f);

}

private void CarachterRoatation()

{

currentCameraRotationLeftRight += _mouseInput.x * mouseSensitivity.horizontal;

var targetRotation = Quaternion.LookRotation(new Vector3(0.0f, currentCameraRotationLeftRight, 0.0f));

transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, rotationSpeed * Time.deltaTime);

Debug.Log(currentCameraRotationLeftRight + " " +targetRotation);

}


public void Look(InputAction.CallbackContext context)

{

_mouseInput = context.ReadValue<Vector2>();

}


public struct MouseSensitivity

{

public float horizontal;

public float vertical;

public bool invertHorizontal;

public bool invertVertical;

}