Hi,
i have two bodys and a given rotation offset.
I want to calculate equal but opposite torques for both bodys to get: OrientationBodyA = OrientationBodyB * RotationOffset.
I use the following method, which works if both bodys have uniform inertias (Ixx == Iyy == Izz), like spheres or cubes:
1. Compute QuatA, which rotates OriantationA to match OrientationBodyB * RotationOffset.
2. Convert QuatA to AngularVeloictyA and convert this to TorqueA, introducing Inertia of BodyA.
3. Do the same like A->B for B->A, leading to: AngularVeloictyB = -AngularVeloictyA, TorqueB is calced with Bs Inertia.
Now i have two Torques with them i can move either A or B to fullfill the desired result, but i want to move both bodys...
4. Scale torques: TorqueA *= TorqueB.length / (TorqueA.length + TorqueB.length), and same opposite for B.
Now i have 2 Torques of equal length and opposite direction. Simulation is fine and correct.
But if Inertias are nonuniform, Torques directions are not opposite, and simulation becomes vibrant.
That's because the shortest path of rotation is not the most easy to do, so in reality bodys would choose another path.
Tuning torque vector by hand i found that it's still possible to match offset by equal opposite torques,
but after days of research i still don't know how to calculate this...
Anyone have had a similar problem? Didn't found anything in net.