Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

23 lines
613 B

namespace Oculus.Platform.Samples.VrHoops
{
using UnityEngine;
// Helper class to attach to the MainCamera so it can be moved with the mouse while debugging
// in 2D mode on a PC.
public class Camera2DController : MonoBehaviour
{
void Update ()
{
if (Input.GetButton("Fire2"))
{
var v = Input.GetAxis("Mouse Y");
var h = Input.GetAxis("Mouse X");
transform.rotation *= Quaternion.AngleAxis(h, Vector3.up);
transform.rotation *= Quaternion.AngleAxis(-v, Vector3.right);
Vector3 eulers = transform.eulerAngles;
eulers.z = 0;
transform.eulerAngles = eulers;
}
}
}
}