# [ODE] solid terrain representations that are still tunnelable?

mucki michael.lacher at hlw.co.at
Thu Feb 24 19:36:00 MST 2005

```Well, you could modify the heightmap collider to actually have a double
heightmap: One layer on top, and an infinite number (linked list) of
additional halfspaces below it. If you imagine one cell form the side,
this could look like this:

+----------+   top halfspace
|          |
|          |
+----------+   ceiling
|          |
|          |
+----------+   floor
|          |

The algorithm would be quite simple: (I just use already constructed
plane equations for each plane inside a heightmpa cell, but this could
of course be constructed at runtime from the corner heights:

checkCell(Cell c,Volume v)
{
bool inside=false;

Plane p=c.getFirstPlane();
while (p)
{
if (v.isAbove(p)) break;
inside=!inside;
p=c.getNextPlane(p);
}

return inside;
}

In short: you just run through the planes, until you find the two which
surround the volume, and then determine if this is outside (even number
of planes over volume) or inside (odd number of polys).

regards,
mucki

Megan Fox wrote:
> Given my spec, I need a heightmap terrain that I can drop down through
> (caves, crevaces and the like), but I'm still not wild about the idea
> of a trimesh paper-thin collider for the entire thing.
>
> Given this, I'm wondering if anyone has tried something like a layer
> of thin boxes, one per heightmap grid, oriented to the grid's normal
> and sized to cover the grid entirely.  Seemingly, this would give you
> a terrain representation that had the advantages of a solid geom,
> while still allowing for the creation of holes through it and the
> existence of geometry under it.  You of course wouldn't actually have
> a separate geom per grid, this is just how you would treat the
> collision calculations.
>
> (this as opposed to a "anything under the heightmap is penetrating" approach)
>
> The one problem I can see with it would be a possibility of strange
> collisions on extreme external points in the heightmap terrain, though
> it would depend largely on the depth of the box representation.
>
> -Megan Fox
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>
```