BlueGit

blue-star ggj-2020

Files

ggj-2020 / Assets / Oculus / Platform / Samples / VrHoops / Scripts / Camera2DController.cs

Camera2DController.cs

Project Import
timfa Tim Falken · pushed by timfa · 6 years ago
b77834a1 History
Camera2DController.cs 613 B Download Raw
1namespace 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}