[ODE] Heightfield collider

David Walters hidden.asbestos at googlemail.com
Fri Jul 7 02:56:15 MST 2006

* From a direct e-mail to me. I figured this would be useful
information until I make a start on adding some documentation.

> - Why is the heightfield callback using int instead of dReal as before ?
> (Position here are always real, but never ints... )

The callback parameters x,y are the index of the cell from 0 to
sample_count, rather than the s,t from 0 to terrain_width/depth. A
fractional component to this value has no meaning with a uniform grid
spacing so the values are of type int for this reason.

> - Can you give some hints on the last 4 parameters of
> dGeomHeightfieldDataBuildCallback ?

(actually this applies to all of the build functions)

* dReal vScale, dRead vOffset :

A uniform scale applied to all heightfield data, regardless of data
mode (byte, short, float, callback). The raw height value has the
following transformation applied before it is used:

    final_height = (height * vScale) + vOffset;

* int nWrapMode :

If nWrapMode == 0 it specifies whether the terrain is finite which
means that the terrain is bounded from 0 to width on the local x-axis,
and 0 to depth on the local z-axis. Collisions should not occur
outside of this range.

If nWrapMode is not zero then the terrain is infinite or "tiled" and
as such will repeat along both the local x and z axes as you would

* dReal vThickness :

This 'thickness' value is subtracted from the minimum height value of
the terrain - these minimum/maximum heights are used when computing
the AABB for the terrain, and as such will cause objects underneath
the terrain but above the thickness baseline to register as
collisions. Note that the thickness is unaffected by the scale or
offset parameters.

> Thanks for the nice work.

You're welcome. Don't forget to read "ode/doc/readme-heightfield.txt"
as this has lots of information that might help to explain things

> Btw, I don't think it's up to you, but I have to point it:  In
> convex.cpp, line 170 IntersctionPlane fourth parameter should be dReal.
> (doesn't compile on vc2005 here.)

Rodrigo ?

More information about the ODE mailing list