I want to write a script that will rotate the wheels of my car if the rotation Y of my wheel is equal to or less than 50. So that the wheel stops rotating when its at 50.
Can anyone please help me im new to coding
I want to write a script that will rotate the wheels of my car if the rotation Y of my wheel is equal to or less than 50. So that the wheel stops rotating when its at 50.
Can anyone please help me im new to coding
Just for clarity of terms, you are not using it as a parameter here, you just want to use it in an expression.
If you want to read the euler angles of your transform you can do one of the following:
Vector3 eulerAngles = transform.eulerAngles
or
Vector3 eulerAngles = transform.rotation.eulerAngles
Then you can read the y component as eulerAngles.y
Be aware though that this will be world-space rotation. If you want the local rotation you can do this:
Vector3 eulerAngles = transform.localEulerAngles
or
Vector3 eulerAngles = transform.localRotation.eulerAngles