I am quite new to Unity, and i am building an asteroids style game with a spaceship with a turret on top to shoot the incoming asteroids. I am using the mouse to rotate the top of the turret and i want to limit the range of the rotation on the Z axis so it cant point at the ship it mounted on or rotate up past 90 degrees and be upside down but n mater what i try i have been unable to get it to work. Any help would be much appreciated. Below is the script i am using.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
Please look at this page for posting on the forums: Using code tags properly
It will show you how to add code so it appears nicely (and for others to read more easily)