[ODE] Re: Heightfield / Collision.

Amund Børsand amund at c2i.net
Tue Feb 18 08:35:02 2003


Nate W <coding@natew.com> skreiv:

> On Tue, 18 Feb 2003, Amund [ISO-8859-1] Børsand wrote:
> 
> > > The actual heightfield is a 'sampling' at some resolution, that
> > > represents a smooth, unfaceted terrain. Isn't it possible to test for
> > > intersections against some form of interpolation function (e.g.
> > > bilinear or bicubic), instead of triangles? 
> > 
> > My thoughts were that such a test would be extremely quick for any point
> > in the map, which could be calculated instantaneously

> Then the trick is finding the right X and Y coordinates for your
> Z-and-normal lookup (assuming the height map builds on the XY plane, with
> Z being "up").  If you have a sphere falling straight down toward a steep
> section of terrain, how do you compute the X and Y for the contact point?  
> You can't look straight down from the sphere's center, because steep
> terrain is going to contact the sphere from the side.  Is there a fast way
> to get the answer?  

Hmm, very good point indeed. But this would be no easier with triangles,
unless the triangles on the ground are larger than the whole sphere.

But, won't you be using a bounding box test first? Then the corners of
the box would be four different points, right? Or do you use a
sphere-test right away, ie distance from center=r? There has to be some
way to do this with a heightmap as well, just find the highest points
under the sphere and interpolate exact points later, maybe?