There's no "easy" answer to this unless your mesh is based on some

mathematical formula. If you look at some the MS examples, such as the

billboarding example which flys over the landscape, you'll see a function to

calculate a height from a "heightfield". Their samples are fairly simple and

can be calculated with a simple formula.

If you have an arbitrary mesh as your "ground", the only real way to figure

out the height is to calculate it based on what triangle you're over. There

are many good books on the subject ("Real-Time Rendering" and "3D Engine

Design"), but it's fairly complicated - ie, some decent amount of math is

involved. The basic idea, as you might have guessed, is to figure out which

triangle you're "over" then project downwards onto the triangle to find the

exact point that intersects the triangle and figure out the height from

there. You could "cheat" for some cases and take an average of the heights

of the 3 vertices for the triangle, bump it up a tad to "hover" and use that

or pick the highest vertex and bumpt that up a tad. It all depends on how

accurate you want to be.

If your landscape is relatively flat, you may be able to come up with a

better solution that doesn't necessarily hover exactly, but just stays above

the ground. I'd start by looking at some of the "simpler" MS examples and/or

reading up on 3D collision detection. You might check out gamedev.net as

they have a number of decent articles as well.

-ner

Quote:

> Can someone give me an idea on how to achieve this?

> I want to move over a mesh at a height of 1 units. That means if my

> landscape (mesh) has bumps and stuff it should always be at 1 unit high

from

> the land.

> I have all the routines to move around, but i cant keep the height

right...

> any ideas?

> Joaquin Grech

> --

> Software development.

> http://www.bocazas.com