So, after many unsuccessful attempts, I’ve failed to put limitations on how far my camera can rotate. My query; I want to access the y variable of the transform and use the number given to turn a bool on and off.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RotateCam : MonoBehaviour {
public static bool GreaterThen;
public static bool LessThen;
public Vector3 yValhue;
void Start(){
GreaterThen = false;
LessThen = false;
}
void Update () {
yValhue = Vector3 (0, transform.rotation, 0);
if (GreaterThen == false) {
if (Input.GetKeyDown (KeyCode.LeftArrow)) {
transform.RotateAround (Vector3.zero, Vector3.up, 300 * Time.deltaTime * 2);
if (yValhue = 30) {
Debug.Log("Oh jeez I guess greater then is off");
}
}
}
if(LessThen == false){
if (Input.GetKeyDown (KeyCode.RightArrow)) {
transform.RotateAround (Vector3.zero, Vector3.down, 300 * Time.deltaTime * 2);
//if (yValhue = 30.0) {
Debug.Log ("Wow! You're not a big fool after all! Less then ain't runnin' no more.");
}
//}
}
}
}
I know, I know. I’m definitely new. I ONLY want to set limits on the rotation of the Y axis. Why is it so hard?? I am but a simple boy please have mercy C# gods-
But anyways, thank you in advance.