flying over a mesh
Author Message
flying over a mesh

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.*-*-*.com/

Sun, 26 Jun 2005 19:48:53 GMT
flying over a mesh

hmmm...My approach would be to develop a collision
detection module. Test for collisions between the bottom
of the ship (+ an arbitary amount) and the lanscape then
increment your y value by this amount.

Sounds great in theory...only problem is I have no idea
how to perform collision detection......

Any ideas on collision detection?

Sun, 26 Jun 2005 20:19:09 GMT
flying over a mesh

check out my heightmap editor at matrixvb.da.ru it has collision detection
in it

Quote:
> hmmm...My approach would be to develop a collision
> detection module. Test for collisions between the bottom
> of the ship (+ an arbitary amount) and the lanscape then
> increment your y value by this amount.

> Sounds great in theory...only problem is I have no idea
> how to perform collision detection......

> Any ideas on collision detection?

Mon, 27 Jun 2005 00:03:21 GMT
flying over a mesh
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

Mon, 27 Jun 2005 11:49:09 GMT
flying over a mesh
My suggestion
use [intersact] fuction make a ray to test the height of the land mesh
first,it will return the distance from your ray point, then u can calculate
the height,after that draw your plane

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

Mon, 27 Jun 2005 14:51:45 GMT
flying over a mesh
If your terrain was generated from a heightmap - then just read the height
from the heightmap....

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

Mon, 27 Jun 2005 16:17:24 GMT

 Page 1 of 1 [ 6 post ]

Relevant Pages