| 1 | namespace Oculus.Platform.Samples.VrHoops |
| 2 | { |
| 3 | using UnityEngine; |
| 4 | |
| 5 | // Helper class to attach to the MainCamera so it can be moved with the mouse while debugging |
| 6 | // in 2D mode on a PC. |
| 7 | public class Camera2DController : MonoBehaviour |
| 8 | { |
| 9 | void Update () |
| 10 | { |
| 11 | if (Input.GetButton("Fire2")) |
| 12 | { |
| 13 | var v = Input.GetAxis("Mouse Y"); |
| 14 | var h = Input.GetAxis("Mouse X"); |
| 15 | transform.rotation *= Quaternion.AngleAxis(h, Vector3.up); |
| 16 | transform.rotation *= Quaternion.AngleAxis(-v, Vector3.right); |
| 17 | Vector3 eulers = transform.eulerAngles; |
| 18 | eulers.z = 0; |
| 19 | transform.eulerAngles = eulers; |
| 20 | } |
| 21 | } |
| 22 | } |
| 23 | } |