- Home /
Question by
karafs · Dec 03, 2013 at 01:40 PM ·
rotate object
Rotate object
Hi, is any function to rotate an object for 180 degree from it's angle in z axis if press a key?
Comment
Answer by T27M · Dec 03, 2013 at 02:26 PM
Does this do what you want?
if(Input.GetKeyUp(KeyCode.Z)){
transform.RotateAround(transform.position, new Vector3(0,0,1f), 180f);
}
Great, can you mark the answer as accepted. As a side note you might want to avoid hard-coding values such as the $$anonymous$$eycode etc, and use the input manager.
Your answer
![](https://koobas.hobune.stream/wayback/20220613123319im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Billboard script restrictions 1 Answer
Rotate the shortest way? 6 Answers
Tank stabilization 1 Answer
Trouble understanding Quaternion.identity in tutorial 1 Answer
Parent rotation on a BoxCollider2d 0 Answers