[ODE] Possible solution to unstable rotating bodies problem

Adam D. Moss adam at gimp.org
Fri Apr 8 13:08:39 MST 2005


Adam D. Moss wrote:
> Erin Catto wrote:
>> In my engine I don't include the inertia torque term: cross(omega, 
>> I*omega).
>> Without this term you get conservation of angular velocity rather than
>> conservation of angular momentum. This leads to greatly increased 
>> stability
>> at the cost of decreased accuracy.
> 
> I think (but am not entirely certain) that the attached
> patch to ODE properly omits the inertial torque (for QuickStep).

I've disabled my spin-damping and can't make my objects go spin-crazy
with the patch applied, where it's very easy to make objects go spin-
crazy without the patch.  So I think this confirms Eric's diagnosis
and my patch w.r.t. QuickStep (more testing welcome from others though).

As a side-note I'm not seeing anything conspicuously unreal-looking
with the inertia torque term removed.

--Adam
-- 
Adam D. Moss   -   adam at gimp.org
-------------- next part --------------
Index: vendor/ode/lib/libode.a
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: vendor/ode/ode/src/quickstep.cpp
===================================================================
--- vendor/ode/ode/src/quickstep.cpp	(revision 4041)
+++ vendor/ode/ode/src/quickstep.cpp	(working copy)
@@ -550,9 +550,13 @@
 		// compute inverse inertia tensor in global frame
 		dMULTIPLY2_333 (tmp,body[i]->invI,body[i]->R);
 		dMULTIPLY0_333 (invI+i*12,body[i]->R,tmp);
+#if 1
+                // intertia torque experimentally omitted for stability
+#else
 		// compute rotational force
 		dMULTIPLY0_331 (tmp,I+i*12,body[i]->avel);
-		dCROSS (body[i]->tacc,-=,body[i]->avel,tmp);
+                dCROSS (body[i]->tacc,-=,body[i]->avel,tmp);
+#endif
 	}
 
 	// add the gravity force to all bodies


More information about the ODE mailing list