- Home /
Question by
Guzaii · Feb 01, 2015 at 06:03 PM ·
rotationjavascriptplayer
Rotate Gameobject on Z axis only (.JS)
Im working on this "gravity switch". Where i want the player to rotate 180 on the z Axis. I've searched for ours. Without finding what i need. I got this. But it does not work.
if(Input.GetKeyUp(KeyCode.G)){
Physics.gravity = Vector3(0, 9.81, 0);
transform.eulerAngles.z = Vector3.(180);
Comment
Best Answer
Answer by karljj1 · Feb 01, 2015 at 11:06 PM
What about Transform.Rotate?
http://docs.unity3d.com/ScriptReference/Transform.Rotate.html
transform.Rotate( 0, 0, 180 );
I didnt think of transform.Rotate that way. When i looked at it, i got a little confused. But i'll try it out :)