Skip to main content
gamedev.net
🔒 Locked 🎮 Unity

Angular Velocity affecting Eular angles

Started by andresch 1 reply 1k views
Original Post
andresch
andresch
I’m trying to dive an object to a desired orientation by setting the angular velocity. So, I take the current orientation in Eular angles, take the desired orientation in Eular angles, and then set the angular velocity of the object around x, y, and z based on the difference between the Eular angles. This works fine as long as the Eular angles stay small. However, if for instance the object is rotated 180 degrees around the y axis, then applying a positive angular velocity around the x-axis causes the x Eular angle to get smaller, not bigger. Perhaps this is because Eular angles are intended to be applied successively, while angular velocity is applied on all three axes at once? Is it possible to account for this just by changing the sign of the velocity sometimes, or is this approach fundamentally flawed for some reason? This line of thinking may be flawed for other reasons. If the object is rotated 90 degrees around z, (note that I’m not talking about Gimball lock here) then velocity around the x-axis changes the y Eular angle, not the x like I would want. Do I need to “unwind” the Eular rotations to know what velocities are needed to correctly change the Eular angles? Perhaps angular velocity can more predictably change the components of a Quaternion or rotation matrix, such that I can calculate what velocity around x, y and z would move it the right direction? (Note that I cannot set angular velocity around and arbitrary axis, although that would simplify this immensely) Thanks for any advice you can offer, Andy
JohnBolton
JohnBolton
3 Euler angles means 3 separate rotations. As you probably already know, the order that these rotations are applied makes a difference. That is, XYZ will give you different results from YXZ. However, if you do XYZXYZYXZ... where each are very small fractions of the desired rotations, then the result will again be different, but in this case, it is as if the rotations are simultaneous and the order doesn't matter.

Generally, when you have unrestricted orientation, it is best to avoid Euler angles. You are probably better off using axis-angle or matrix or quaternion representations for the rotation.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
andresch
andresch
I believe the above response is right. I’m using Euler angles that are intended to be applied sequentially and then using velocity which applies the rotations at the same time, giving me incorrect results. That is why it works if the angles are small enough, as rotation is “cumulative” for small rotations.

I tried a new approach last night, and for a minute there I really thought I was on to something, but alas, no dice. Google lead me to the logic on this page, at the bottom it takes an angular velocity around an arbitrary axis and decomposes it into rotations around x, y and z. I thought this would work for me, as I took the desired rotation as an axis/angle, and then figured the correct velocity around that axis. Then I used the logic at the link above to break the angular velocity into the three components of x, y and z. At first when I tested it, it worked! But as I tried more rotations it became clear that this approach still has problems, in fact as soon as the orientation of the object got either y or z axis rotated more than 90 degrees, the logic stopped working.

I now believe I should approach the problem like this:
Given an angular velocity represented as a velocity around an arbitrary axis, how do I break that up into velocities around the principal axes of x, y and z?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.