Skip to content

Commit c068ce6

Browse files
authored
add EditorCardboardCamera script
1 parent ac3ae83 commit c068ce6

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
5+
// editor only Google Carboard VR cam simulation with left alt + mouse
6+
7+
public class EditorCardboardCamera : MonoBehaviour
8+
{
9+
#if UNITY_EDITOR
10+
Vector2 rotation = Vector2.zero;
11+
public float speed = 3;
12+
13+
void Update()
14+
{
15+
if (Input.GetKey(KeyCode.LeftAlt))
16+
{
17+
rotation.y += Input.GetAxis("Mouse X");
18+
rotation.x += -Input.GetAxis("Mouse Y");
19+
transform.eulerAngles = (Vector2)rotation * speed;
20+
}
21+
}
22+
#endif
23+
}

0 commit comments

Comments
 (0)