Closed trusktr closed 8 years ago
This is expected. Rotations are always being stored as quaternions. Therefore getRotation
returns the rotation as a quaternion.
Calling setRotation
afterwards with euler angles results into the passed in rotation to be converted to a quaternion and stored as such.
In order to achieve the expected behavior you would have to store the set rotation separately.
Converting the quaternion back to euler angles after getRotation
won't work due to the nature of quaternions.
@alexanderGugel Gotcha. So define the unit vector, then right hand rule for positive rotation?
I thought I could rotate something simply by ding something like this:
But the expected doesn't happen. Instead of the Y rotation incrementing by
Math.PI/4
, the value of the increment turns out to be smaller and smaller each tick of the interval.Here is the repeated output of the
console.log('rotation:', currentY, newY, w)
:On the first output, you see
. The expectation is that on the second output, the first of the three numbers will be the second number of the first output, so the expected second output would be something like
As you can see, that's not what's happening, and the fourth number of the rotation (
w
) is also changing on it's own. The actual second output is this:The first number of this output is only slightly bigger than the first number of the previous output. After a while, the delts from output to output becomes smaller and smaller, which is why at the last output in the screenshot we see a counter indicating how many of the same output has been logged.
Any ideas what's going on here? I'm not setting the 4th arg when I call
Node#setRotation
, so I'm just expecting to manipulate X, Y, and Z rotation. Is there something I'm not getting about rotation in Mixed Mode? Or might this be a bug?