Hi everyone,
I’m totaly new in Unity. I have to create an animation of my crane and I want to limit rotation of this (90° Left and 90° right). Does anyone has an idea to do that? After many of rearches, i can’t figure out it
I used a code C# but it not works for me.
transform.Rotate (new Vector3(0,0,Time.deltaTime)
Thank you very much!
you can grab the rotation like if you aret rotating in y;
Vector3 rotation;
void Update(){
//All the rotation code
rotation.y = Mathf.Clamp(rotation.y, -90F, 90F)
}
It also works for X and Z
Hi,
Thank your for your comment. I want to do like this
But i dont want the crane rotate 360°
For my scritp, it’s simple. in void update, i have:
transform.Rotate (new Vector3(0,0,Time.deltaTime)
That’s it.
But my crane rotate 360°.
Do you have an idea for using Euler angles for limit rotation please?
Thank you!