Physics of the spring. How to find the point of rotation using a quaternion?
Hello. Write a simulation of a spring with ODE and Panda3D for rendering. With a simple movement it's simple: the force is applied proportional to the distance is subtracted, the force is proportional to speed and the body gradually returns to a given point. If proportional speed read, the body performs harmonic oscillations in the vicinity of a given point. With the rotation and the moment... Neither rotation matrices nor their derivatives, or their arccosine and arctinus no result. In the best case, the body spins around 0Z in the worst does random spins and flies into space. To keep the specified angle, do not want in any.
The successful implementation of the rotation I don't consider the rotation only 0X and 0Y. The body get quarternion and make every moment proportional to X or Y. of course any deviation around the Z axis leads to the unwinding and space flight. If the body does not rotate around Z, the body successfully holds a specified angle after applying external forces.
How to calculate the torque necessary to rotate in the direction specified by the quaternion, the body adhered to a given angle?
anahi_Monahan answered on September 26th 19 at 06:49
You mean the inertia tensor? This is not a quaternion.
Thing catchy (yet familiar), but in fact completely analogous to linear mechanics: how do you get the vector acceleration by dividing the force vector on the inertia, as surely you get a vector of the angular acceleration by dividing the moment of the force vector on the inertia tensor. And no twitching of the left will not work - mother nature will take care of (with proper design of the inertia tensor, of course).
bobby48 answered on September 26th 19 at 06:51
David Baraff in his lectures describes this whole thing: www.cs.cmu.edu/~baraff/sigcourse/notesd1.pdf
The moment of inertia is a diagonal matrix, which is set in the time of the creation of the body. It's a sort of "mass" for rotational motion.
deangelo.Stokes answered on September 26th 19 at 06:53
The idea is I just need to know what the angle of the quaternion forms with the coordinate axes. Just how to do it?