[ODE] Terrain LOD and trimesh collision detection
Jon Watte (ODE)
hplus-ode at mindcontrol.org
Mon Apr 3 17:17:55 MST 2006
Jean-Sebastien Guay wrote:
> I was wondering what to do with collision detection in that case. Should I just
> make a trimesh with the highest resolution terrain and let the collision
> detection always use that, or should I update the trimesh with the results of
> LOD every frame / time step?
Most consistent would be to collide with a specific level of detail,
always. This may or may not be your finest level of detail for graphics
display. Also note that there is a heightmap collider (I think it's a
contrib) you might want to look into.
What I would do is cache collision tiles at the right resolution. When
objects bounding boxes intersect with specific tiles, I make sure those
tiles are actually in RAM, but if there are tiles that haven't seen use
for a while, I can re-cycle the memory for those into newer created tiles.
If you have the memory to build all of your terrain at the same time at
a given level of detail, for collision, then go for it. It'll be faster
at runtime, and it will be much easier to implement.
> I'm having a hard time figuring out if updating the trimesh often will take
> more time that just using the full resolution terrain in the first place.
The trimesh code has a highly efficient AABB tree built-in, so it's
unlikely to take a lot of extra time to collide with larger meshes. The
search time is O(log N) where N is the number of triangles in the mesh.
Cheers,
/ h+
More information about the ODE
mailing list