I made my own mouselook script as simple as possible but i got some errors/bugs
**The script is attached to the camera **
I think i only need to set the max up and down angle to fix my problem but i dont know…
So my problem is that my camera starts rotating in every direction even i Z…
Exactly i dont even know why this happens or what my problem is so here is the script:
using UnityEngine;
using System.Collections;
public class Rotate : MonoBehaviour {
public float rotSpeed;
public float x;
public float y;
void Update () {
x = Input.mousePosition.x;
y = Input.mousePosition.y;
if (x > Screen.width / 2)
transform.Rotate (new Vector3 (0, 1, 0) * rotSpeed * Time.deltaTime);
if (x < Screen.width / 2)
transform.Rotate (new Vector3 (0, -1, 0) * rotSpeed * Time.deltaTime);
if (y > Screen.height / 2)
transform.Rotate (new Vector3 (-1, 0, 0) * rotSpeed * Time.deltaTime);
if (y < Screen.height / 2)
transform.Rotate (new Vector3 (1, 0, 0) * rotSpeed * Time.deltaTime);
}
}