- Home /
How to rotate an object?
Quaternion is unnecessarily complicated. To move object you just use transform.position and a vector, easy. To rotate, this one is very confusing.
Quaternion is unnecessarily complicated?
What point does this even make? You want to do a math discussion go here: http://math.stackexchange.com/
Otherwise HF with a gyro that gets stuck. (Although I have to agree that seemed to be a mechanical problem rather than a software one to me :/ )
Answer by robert 4 · Mar 01, 2011 at 04:24 PM
function Update() {
// Slowly rotate the object around its X axis at 1 degree/second.
transform.Rotate(Vector3.right * Time.deltaTime);
// ... at the same time as spinning relative to the global
// Y axis at the same speed.
transform.Rotate(Vector3.up * Time.deltaTime, Space.World);
}
Answer by simplyRubbish · Mar 01, 2011 at 04:20 PM
I believe you can use Quaternion.Euler() that takes in a Vector3 and will convert to the Quaternion you need. Here's a link to go into full detail: http://unity3d.com/support/documentation/ScriptReference/Quaternion.Euler.html
Your answer
![](https://koobas.hobune.stream/wayback/20220613110825im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Extrapolating Quaternion Rotation 2 Answers
Make Quaternion affected by float 1 Answer
Rotation of an object with quaternion 1 Answer
why can't my Rigidbody not rotate on slopes? 1 Answer
Writing a custom LookAt() function 2 Answers