[ODE] Terrain colliders and/or Trimesh/OPCODE
Nate W
coding at natew.com
Sun Feb 8 11:14:36 MST 2004
On Sun, 8 Feb 2004, John Miles wrote:
> Amund wrote:
>
> > Also, there was another terrain collider in here somewhere, right? How
> > is that one in comparison, and does anyone have a link from where it
> > could be downloaded?
>
> My preliminary tinkering suggests that TriMesh is actually pretty
> effective at representing height-mapped terrain.
There's a heightmap collider included in the source distribution of a game
demo called oracer (google for it), and another in a contribution called
TerrainAndCone, which is in ODE's CVS. I have done a bit of
experimentation with both... The former works OK, but the latter (by
Benoit Chaperot) seems much better. Benoit's terrain collides with more
shapes and does more sophisticated collision detection with each terrain
polygon.
I haven't objectively compared the performance against OPCODE, but I
suspect that Benoit's approach is slightly (negligibly?) faster. Of
course, if you want cavities in your terrain then OPCODE is the only way
to go.
Also, in order to reduce startup time, I have modified both of the
heightmap colliders so that they get their vertex information from a
callback that talks to the terrain engine that's already part of the
project I'm working on. This adds some extra cycles per frame for each
vertex, but there's no startup penalty and no additional storage
requirement. It only took a few lines of code - I just pass a function
pointer in to the terrain constructor, and changed the collider code to
invoke it rather than retrive vertex data from its own data structures. I
have no idea how (or if) this could be done with OPCODE.
Bottom line... I agree with John that OPCODE is effective (I used OPCODE
for Juice's terrain), but I think that Benoit's code is probably better
still. OPCODE has extra storage and startup-time requirements, and (most
importantly) once something passes through an OPCODE mesh, it stops
colliding. A heightmap has a notion of "beneath" that a mesh doesn't
have, and Benoit has provided us with a nice implementation. Again,
unless you need caves, in which case OPCODE is the right tool for the job.
And OPCODE is useful for stuff that isn't terrain, like bunnies. :-)
I've had OPCODE doing terrain in Juice for about a year, but I've only
have a few hours experience each with the two heightmap colliders. So, I
reserve the right to change my mind about this stuff, but I am pretty
confident the assessment above.
--
Nate Waddoups
Redmond WA USA
http://www.natew.com/
More information about the ODE
mailing list