[ODE] Performance patch : not checking collision between disabled
bodies
Adam D. Moss
adam at gimp.org
Wed May 26 11:57:56 MST 2004
Nice, but I'm not totally dead keen on this myself... I think
it's putting a bit too much policy into collideAABBs() that
really belongs in the nearcallback.
The most it saves in the early-escape case versus doing the same
thing at the start of the callback is a trivial box-disjoint test,
two geom-AABB tests and a function call overhead.
The geom-AABB tests are probably the most expensive things there
when implemented (and conversely probably the least-likely to cause
an escape short of the full-blown collision test done by nearcallback,
but I haven't tested that :)) but ODE's policy could be changed to
make calling AABBTest the responsibility of the nearcallback (this
doesn't break old code) or skipped entirely (i.e. for sphere-
sphere collisions where I expect it's a lot cheaper to do a full
collision test than two sphere-AABB tests, and the app knows better
than anyone whether sphere-sphere tests are the common case).
Then deciding what to do with disabled-disabled tests become a
matter of app policy, which I do personally prefer.
... Or, the calling of almost all of collideAABBs() could become
the responsbililty of the nearcallback, rather than the other way
around. ;) (Except for the collide_bits stuff which IMO doesn't
really belong in collideAABBs anyway.)
I don't think this patch is correct as it is though. It assumes
that both bodies are !=0 but I don't believe that this has to
be true (otherwise the earliest existing escape of:
if (g1->body == g2->body && g1->body) return;
does not totally make sense).
Regards,
--Adam
--
Adam D. Moss . ,,^^ adam at gimp.org http://www.foxbox.org/ co:3
More information about the ODE
mailing list