- Home /
Stopping object rotating at a certain rotation
So ive got a player(that can flip using "a" and "d") with an arm, and that arm rotates to point at the mouse. However the arm can rotate all the way around so that it is sticking out of the players back. Therefore i need to stop the arm rotating at a certain point and then allow it to rotate back into an "allowed" area.
Any help would be appreciated.
Thanks
Answer by eneIr · May 14, 2019 at 05:45 AM
@Adsothegreat you can use code like: if (transform.rotation.x > maxrotation) { transform.rotation.x = maxrotation } in the Update ()
it says that you,"cannot modify the return value of Transform.rotation because it is not a varible"
attach this code to that arms and remember the code is transform.rotation.x did you remember to write .x?
Your answer
Follow this Question
Related Questions
Moving and rolling a cube 1 Answer
shoot bullet on a moving gameobject 0 Answers
Unable to turn character upside down due to problem with mouse look script 1 Answer
Maybe easy to do, but: How? 2 Answers