지금 카메라 이동과 관련된 것을 작업 중인 학생입니다.

문제가...  마우스일때는 마우스의 x,y기준으로 받아오던 값을 모바일로 할때는 어찌 되는건지 감이 안오던ㅠ


밑에 코드가 화면에 마우스 오른쪽 클릭했을때 자유롭게 화면회전 가능한 스크립트인데 이걸 모바일버전으론 어찌 바꿔줘야 할까요??

void CameraRotation()

    {

        if (transform.rotation != TargetRotation)

            transform.rotation = Quaternion.Slerp(transform.rotation, TargetRotation, RotationSpeed * Time.deltaTime);

 

        if (Input.GetMouseButton(1))

        {

            // 값을 축적.

            Gap.x += Input.GetAxis("Mouse Y") * RotationSpeed * -1;

            Gap.y += Input.GetAxis("Mouse X") * RotationSpeed;

 

            // 카메라 회전범위 제한.

            Gap.x = Mathf.Clamp(Gap.x, -5f, 85f);

            // 회전 값을 변수에 저장.

            TargetRotation = Quaternion.Euler(Gap);

 

            // 카메라벡터 객체에 Axis객체의 x,z회전 값을 제외한 y값만을 넘긴다.

            Quaternion q = TargetRotation;

            q.x = q.z = 0;

            CameraVector.transform.rotation = q;

        }

    }

- dc official App