In a physics engine both an object's orientation and angular velocity can have an axis angle representation (a 3D vector) because both of them are rotations. In fact the difference between orientation and angular velocity is that, angular velocity is a rotation with a context of unit time and orientation is simply a rotation. When we pile two rotations, we can't simply sum the two vectors that represents the corresponding rotations simply because vector math is commutative, but composition of rotations is not, and we have to use matrix or quaternion to do so. One the other hand, we can pile two angular velocities by adding them together, and the proof in the following excerpt is straightforward. Now the question is that, why sometimes we can sum two rotation vectors, but sometimes we can not. This is because if two rotations are small enough, the sum of the two rotation vectors will be infinitely close to the composition of two quaternions. As an analogy, when an arc is small enough, it can be treated as a straight line. There is a very good article to visualize compositions of rotations. One conclusion from this article is that, if the circle containing the arc AC represents the result of merging two rotations, then the circle containing the arc C"A" will be the result of merging two same rotations in a swapped order. As the two rotations that are merged become smaller and smaller, plane AOC will be parallel to plane C"OA", and the composition of two rotations become commutative. In physics-based animation, our numeric solution will be infinitely close to analytical solution if we are using infinitesimal time step. When angular velocity is paired with a small time step, rotation itself will also be small, which makes the fact that we can add angular velocity vectors perfectly reasonable. Furthermore I did an experiment in Unity by using PD control. The standard way to generate angle difference in order to compute the proportional part is to use either matrix or quaternions. In the excerpt down below, I simply uses vector math and it will generate exactly the same result as using matrix or quaternions (i.e. in the video down below, targets are exactly reached). This is because both physics body and reference body have the same initial state. No large state difference can be created within each time step I am using, so the state/angle difference computed by vector math is accurate enough to driven physics body to reduce this state difference. In fact whenever state difference is reduced, it will make vector math more accurate and closer to the standard golden solution.
0 Comments
Leave a Reply. |