- Home /
Return Object Rotation to x axis is zero
Hi everyone
My object Rotates in the x, y, z axis. But now I want my object returns only in the X axis into 0.0 if I click a GUI.Button.
Can Someone help me please. The z and y axis don't maight be changed, only the x axis.
Hello Androids, perhaps you could be more specific. Do you want a physics (rigidbody) object to rotate back to 0 on the x-axis, or is it a Character Controller? Is this script going to be attached to the rotation object? Is it going to be attached to a player? Please answer as soon as possible.
Also, I think your question isn't meant for Unity Answers, rather Unity Forums. There you can get help from people on more generic issues, such as making a script for you. When you make a script and then find problems, Unity Answers is here to help fix specific issues.
Anyway, best of luck!
Answer by whydoidoit · Mar 03, 2014 at 08:53 AM
You can do it like this:
CS
var rot = transform.eulerAngles;
rot.x = 0;
transform.eulerAngles = rot;
JS
transform.eulerAngles.x = 0;
Your answer
Follow this Question
Related Questions
Returning position of game object in c# 2 Answers
Locking object (or animation) to X or Y axis 1 Answer
Float seen as Object, help? 1 Answer
Return Transform by String Parameter 2 Answers
Return a value for a class? 1 Answer