Created
May 15, 2016 21:17
-
-
Save FCkaisei/a843c67d4c7fc9c4f3ee50b54766efb9 to your computer and use it in GitHub Desktop.
Unity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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