# How to set a max rotation angle

Hey guys. I’m fairly new to scripting so I apollogise if this turns out to be really basic. I’m building a car controller rig. I have got a basic move script attached to the prefab as a whole and it works fine but I am wanting to set up some underlying scripts to control the wheels so they turn with the car to make it feel more realistic. I have the rotating down good but I cannot figure out how to set a maximum rotation so the wheels don’t just keep rotating around into the wheel well. After spending days trawling the net for a sokution to my problem but cannot find a relevant answer. I have tried learning as much as I can about quaternions and euler angles but so far nothing I jave learned aboit them has helped. If anyone could give me some examples would be great and if you could explain why and how that way would work would be even better.

Here is a brief example of my rotating wheel code:

If (Input.GetKey (KeyCode.D)) {
transform.Rotate (Vector3.up * turnspeed * Time.deltaTime) ;
}

And this just basically repeats for each direction witha GetKeyUp function to return the wheels back to being adjacent with the car ounce it is done turning

Sonthofen like that shult work:

If (Input.GetKey (KeyCode.D)) {
If (Transformation.eulerangel() < yourangel){
transform.Rotate (Vector3.up turnspeed Time.deltaTime) ; }
}

(Don’t know if eulerangel is the right function name)