[ODE] Methods of handling terrain

Matthias Grumet matthias at grumet.at
Fri Feb 18 17:02:38 MST 2005


Hallo Paul,

a few days ago, i started working on the very same thing! :-)
i still have a few problems with the terrain though.

i have my heightfield data in a 2-dimensional array and fill the
Vertices/Indices the following:

        for (int i=0;i<size;i++) {
                for (int j=0;j<size;j++) {
                        Vertices[k][0]=(dReal)i;
                        Vertices[k][1]=(dReal)getheight(i,j);
                        Vertices[k][2]=(dReal)j;
                        k++;
                }
        }

        k=0;

        for (int i=0;i<size*size-size;i++) {
                Indices[k++]=i;
                Indices[k++]=i+1;
                Indices[k++]=i+size;
                Indices[k++]=i+size;
                Indices[k++]=i+1;
                Indices[k++]=i+1+size;
        }

 i am not sure if this is correct, so if anyone else has a better
 solution, please let me know!
  
> 1. Must be able to handle multiple vehicles a long way from each
> other (fairly large world, say 5 km)

my terrain is 64 by 64 vertices.

> 2. Must be able to convert a *modelled* terrain to ode (I want
> the ability to make caverns/caves, so I believe that the terrainZ
> functions won't fit my needs). (I have already written the code to
> import my models, and have some code for converting to trimesh)

what are you using to model the terrain?
i am painting a greyscaled image in Photoshop and load it as a TGA in
my program to get the 2d-array.
  
> I'm quite certain I'll be using a trimesh, and that it'll have to
> be "segmented" into x*y chunks to speed up the collision detection
> process. I had previously tried to implement the terrain model using
> a trimesh, but had trouble with objects falling through it, but I
> have never really looked into it again (I dropped that at the time
> and instead spent my time getting networking, sound, etc working
> while I put more thought into how to handle terrain.)

i too have problems with my car just sinking through the trimesh,
though it should be a solid object.
  

looking forward to hear more input on this topic.

matthias



-- 
| Bakk.techn. Matthias Grumet
| matthias at grumet.at 
| www.embege.com
\____________________________



More information about the ODE mailing list