Quaternion Rotation - Clockwise or Counter-Clockwise? - Game Development Stack Exchange most recent 30 from gamedev.stackexchange.com 2019-09-21T01:14:32Z https://gamedev.stackexchange.com/feeds/question/87612 https://creativecommons.org/licenses/by-sa/4.0/rdf https://gamedev.stackexchange.com/q/87612 3 Quaternion Rotation - Clockwise or Counter-Clockwise? Xenoprimate https://gamedev.stackexchange.com/users/36451 2014-11-21T16:14:25Z 2014-11-21T17:14:43Z <p>when we specify a Quaternion as <code>(axis of rotation, rotation amount)</code>, in which 'direction' is the rotation, assuming we are looking down the rotation axis (i.e. camera at the origin, looking along the axis vector)?</p> <p>Does it depend on the handed-ness of the co-ordinate system?</p> <p>Or is it actually a moot point / stupid question?</p> https://gamedev.stackexchange.com/questions/87612/-/87614#87614 1 Answer by mklingen for Quaternion Rotation - Clockwise or Counter-Clockwise? mklingen https://gamedev.stackexchange.com/users/55160 2014-11-21T16:46:19Z 2014-11-21T16:52:56Z <p><a href="http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation" rel="nofollow">Quaternions</a> are not axis/rotation vectors. That's just not how they work. They do <em>encode</em> an axis/rotation, but not in the way you describe. Check out the equation from wikipedia:</p> <p>Given an axis [a_x, a_y, a_z] and angle theta,</p> <pre><code>q = [a_x * sin(theta / 2), a_y * sin(theta / 2), a_z * sin(theta / 2), cos(theta / 2)] </code></pre> <p>That said, if you <em>do</em> have an axis/rotation vector, it follows the right hand rule. Looking down the axis of rotation, positive rotations will appear clockwise. Point your right thumb along the axis of rotation. The curl of your fingers is the angular motion of a positive rotation along that axis.</p> https://gamedev.stackexchange.com/questions/87612/-/87615#87615 4 Answer by DMGregory for Quaternion Rotation - Clockwise or Counter-Clockwise? DMGregory https://gamedev.stackexchange.com/users/39518 2014-11-21T17:14:43Z 2014-11-21T17:14:43Z <p>It depends on the coordinate system you're working in.</p> <p>In a <strong>right-handed coordinate system</strong> (eg. x right, y up, z points toward the viewer), the <strong>right-hand rule</strong> applies, as mklingen describes in the existing answer.</p> <p>In a <strong>left-handed coordinate system</strong> (eg. x right, y up, z points away from the viewer), the <strong>left-hand rule</strong> applies - you point your left thumb along the rotation axis, and a positive rotation turns in the directions your fingers curl.</p> <p>So it's important to know what coordinate system you're working with. Unity for instance uses a left-handed coordinate system. 3DS Max uses a right-handed coordinate system. Changing handedness flips the sign of an odd number of axes, and all rotation angles.</p> <hr> <p>"Oh, so Quaternions are basically... 4D vectors, then? That we just give another name?"</p> <p>Not quite. Like 4-vectors, they are 4-tuples of numbers, but interpreted such that three of the four components are measured in <a href="http://en.wikipedia.org/wiki/Imaginary_unit" rel="nofollow">imaginary units</a>. That means that two quaternions multiply together differently than they would if composed of real numbers (because 1i * 1i = -1). This weird multiplication means that they combine like 3D rotations do (something you don't get out-of-the-box with real numbers), which is why we often use them to describe rotations and orientations.</p>