- Home /
Question by
dika22 · May 27, 2014 at 05:34 PM ·
rotate objecttransform.
Limit rotate object?
how to limit when object rotate
var arm : Transform;
..
if(Input.GetKeyDown(KeyCode.B))
arm.Rotate (0, 0, 6);
if object rotate at z axis 90 degrees stop?
Comment
Answer by MikeNewall · May 27, 2014 at 05:49 PM
Add a check to see if the rotation is less than 90 degrees before you rotate.
if(Input.GetKeyDown(KeyCode.B) && arm.eulerAngles.z <90)
arm.Rotate (0, 0, 6);
Your answer
Follow this Question
Related Questions
Play movement and restrictions - Similar to a window wiper 2 Answers
Object goes trough everything (Teleporting?) 1 Answer
Snap a object position and direction 1 Answer
How to get rotation data for a 2D sprite? 0 Answers
Get angle difference between two objects to correct the position of a child object 2 Answers