[ODE] using ODE for 2D simulations
Russ Smith
russ at q12.org
Wed Sep 4 13:49:02 2002
> 1: How do I set the inertia matrix for a 2d body?
only one axis in the inertia matrix is important. it's easiest to just set
it as though your body was a sphere.
> 2: If I only apply forces, torques, and joints to the x and y axes, will my
> simulation run in 2d without drifting along the z axis because of floating
> point rounding errors or some other reason?
no. there will be some drift eventually because of numerical error. it's
perhaps possible that with careful alignment of all the ODE numerical code
that this drift could be prevented - but no special care has been taken in
this regard. there are two ways i can think of to prevent drift. (1) put
all your objects on a frictionless 'ground' (z=0 plane) and apply gravity.
your 2D coordinates are then x and y. (2) add an extra constraint for
every body that prevents rotation in x and y. this constraint has not been
written.
> 3 (Most important): I'm concerned about the speed.
ODE has not been optimized for 2D simulations, though it will work (as
above). the constraints are more heavyweight than they need to be, i.e.
they limit motion in directions that you don't care about. it *is*
possible (and quite easy in fact) to make a 2D version of ODE - but i
don't plan to do this myself.
russ.
--
Russ Smith
http://www.q12.org