0
iOS 기기 용 게임을 만들고 있습니다. 내 선수 나 게임 객체가 터치에 따라 회전하기를 원합니다. touchPhase.Moved에서 다음 코드를 사용하고 있습니다.Unity - 터치를 기준으로 오브젝트를 회전하는 방법은 무엇입니까?
if (Input.touchCount > 0 && Input.GetTouch (0).phase == TouchPhase.Moved)
{
coinTouched = true;
if (coinTouched)
{
Vector2 currentTouchPosition = Input.GetTouch (0).position;
endPos = new Vector3 (currentTouchPosition.x, 0, currentTouchPosition.y);
endTime = Time.time;
gameObject.transform.rotation = Quaternion.Euler(0f,Input.GetTouch(0).deltaPosition.x * 1.0f,0f);
}
}
하지만 어색한 행동입니다. 거의 180도 회전하고 반대 방향으로 움직이며 다른 180도 반대 방향으로 회전합니다. 도와주세요.
감사합니다.