Skip to content

Instantly share code, notes, and snippets.

@FCkaisei
Created May 15, 2016 21:17
Show Gist options
  • Save FCkaisei/a843c67d4c7fc9c4f3ee50b54766efb9 to your computer and use it in GitHub Desktop.
Save FCkaisei/a843c67d4c7fc9c4f3ee50b54766efb9 to your computer and use it in GitHub Desktop.
Unity
using UnityEngine;
using System.Collections;
public class raySet : MonoBehaviour {
float y;
void FixedUpdate () {
y -= Input.GetAxis("Mouse Y");
if (y >= -90 && y <= 90) {
Debug.Log (y);
transform.localRotation = Quaternion.Euler (y, 0, 0);
}
else {
if (y <= -90) {
y = -90;
}
else if(y >= 90) {
y = 90;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment