Скрипт поворота камеры:
Синтаксис:
Используется csharp
foreach (Touch touch in Input.touches) {
if (touch.position.x > Screen.width / 2) {
if (touch.phase == TouchPhase.Moved) {
rotX -= touch.deltaPosition.y * Time.deltaTime * sens;
rotY += touch.deltaPosition.x * Time.deltaTime * sens;
rotX = Mathf.Clamp (rotX, -80f, 80f);
Tcam.transform.eulerAngles = new Vector3 (rotX, rotY, 0f);
}
}
}
if (touch.position.x > Screen.width / 2) {
if (touch.phase == TouchPhase.Moved) {
rotX -= touch.deltaPosition.y * Time.deltaTime * sens;
rotY += touch.deltaPosition.x * Time.deltaTime * sens;
rotX = Mathf.Clamp (rotX, -80f, 80f);
Tcam.transform.eulerAngles = new Vector3 (rotX, rotY, 0f);
}
}
}