[ODE] Need performance tips
nearaz
nearaz at interamotion.com
Tue Apr 22 10:57:02 2003
> flat terrain represented by a box geom (until I add support for ODE
> planes) and 20 crates also represented by box geoms. All the crates
Is your terrain-box also a body?
> performance suffers quite a bit. I know that this is happening
> because a lot of contact joints are being generated when the boxes
If your terrain is also a body, then the slowdown is because the terrain and
all the boxes on it form a single island; and thus computation time is
roughly O(N^3), where N is proportional to the number of contact joints. You
probably should try "stepfast" iterative solver in this case... (or read
below).
> I though about detecting
> that the crates have stopped moving (how can this be detected in the
> first place?)
Yes, just disable the bodies that are "inactive" (say, moving/turning only a
little).
> disable the crate bodies so that they don't fall through the ground,
> they will no longer interact with whatever might happen in the world
> (say another box falling in the pile for some reason.)
When a disabled body is joined to non-disabled body by some joint (in your
case - contact joint), it's automatically enabled by ODE. So there's no
problem.
> How do games that deal with large worlds handle such problems?
It's best to not simulate motion of non-moving objects (as the terrain), so
the big islands of connected bodies just don't form. And, as a side note,
games rarely have "physics simulation" as it's in ODE :)
Aras Pranckevicius aka NeARAZ
http://www.gim.ktu.lt/nesnausk/nearaz/