Hi,this script rotates object on world cordinates (around its axis) so what i want to do is,when i press “button” then it only rotates 180 degrees,not all the time,only 180 degrees and when i press again “button” it rotates back to its position. please help me 
function Update() {
transform.Rotate(Vector3.left , Space.World);
}
1 Answer
1
Do you want it to be instantaneous or continuously moving? Either way there is a number of ways to do it.
Instantaneous you can do simply like this:
if(Input.GetButtonDown("Jump")){
transform.Rotate(Vector3(90,0,0));
}
If you want to make a continuous movement it will depend on what kind of movement you want.
edit: of course, “jump” and “vector3(90,0,0)” are just illustrative values. Use whatever you want.