Collision detection in flight simulators

never introduced collision detection in the flight sim i’m currently developing, and i tried to figure out what would be the best method.
I need to detect collision mainly between the player jet with ground and ground structures (hangars, building etc.).
I suppose the bounding sphere or box collision method wouldn’t be adequate, due to the particular shape of the aircraft and the structures, nor i can run an intersection test on any triangle of the objects because would be too slow.
Do you know any other method or suggestion ? Thx

You can use several bounding boxes for the plane and the buildings. Break down the models into groups and use a bounding box for each group. For example, use a bounding box for the left wing, one for the right wing, one for the fuselage, etc… The more boxes on an object, the more accurate the collision detection would be (assuming an octree or some related method).

Start with a single bounding box for each element (plane, building, tree, etc), and when you determine that 2 bboxes collide, go for the actual triangle-triangle checks between only these 2 objects.

As suggested, hierarchical bounding boxes are a good thing too.

For ground, maybe you already have an height field to do the quick checks.

Thanks for your suggestions, i’m going to try some …
However I’m still confused about how to check collision with the ground. It’s a quad strip heightfield but verticies are quite distant from each other, so i don’t know how to test a sphere against a point which lie, for example, somewhere inside a terrain square. Or, well, perhaps i could calculate that but it will take several sin, cos, and sqrt instructions

  

a         b
|---------|
|  *      |
|         |
|         |
|_________|
c         d

Take for example the * point, and supposing i know the heights of a,b,c,d. There is any smart way of calcutating * height ?

>> There is any smart way of calcutating * height ?
The problem is that you don’t want this : the quad is not drawn as a a single plane, but as two triangles You see this as soon as the 4 vertices are not coplanar.

So test against each triangle.

  +----+
  |\   |
  | \  |
  |  \ |
  |   \|
  +----+

I am not sure if the tesselation of quads is implementation dependant, maybe go for triangles to be sure.

If you don’t care of the triangle thing, and the quads are square and axis aligned, you just need simple bilinear interpolation (untested, should no be too far, test with z drawn as color):

ABx = (Px - Ax)/(Bx - Ax)
CAy = (Py - Cy)/(Ay - Cy)

CDx = (Px - Cx)/(Dx - Cx)
DBy = (Py - Dy)/(By - Dy)

ABz = ((1-ABx)Az + ABxBz)
CDz = ((1-CDx)Cz + CDxDz)

Pz = ((1-CAy)ABz + CAxCDz)

(P is the * of your diagram)

Slightly OT, but I tried tu run your sim program, gl horizon 2, and only got to the splash screen, and then nothing more, as if the game was stuck, at 100% cpu usage, ESC does not quit, and I must terminate it from task manager.

Too bad, because it looks cool :frowning:
What about outputing some logs in a file during startup ?
My GL drivers should not be a problem, as Doom 3 and all sorts of (non-GLSL) OpenGL apps are working like a charm. GF 3, detonators 45.23

And can it run in a window ? Easier to read the commands reference that way.

Thx for your help ZbuffeR. Regarding my sim, edit the aerofiles/sim.cfg file and modify it as follows:
0
0
512
1
2
2
0

Parameters explanation here below:

drawtrees
drawclouds
terrain_mesh_complexity
daytime
aircraft
enemy
dynamic shadows

With no dynamic shadows and low level terrain it should run without any trouble. Could you give me more details about your configuration ? For example operating system, cpu, ram, vga card etc ?
If you want you can also email me at alex@flightzone.us

About the log file, i’m currently working on version 3.0 which should be out in a couple of months and will solve some issues and lags i discovered on some hardware configurations.

It works now, by disabling the shadows.
I sent you a private message(to avoid spam), check your profile.

I would just like to mention one thing regarding
collision detection and the use of mathematical
functions for intersection tests, etc.

Since collision detection does not really need to
be very accurate, if you are planning to use hierarhical
bounding boxes and spheres, you should be able to
significantly reduce the computational ovearhead
associated with mathematical functions by simply
using Taylor series expansions. They are cheap, and
if used on the “higher level” intersection tests
they should be just fine.

To be honest, I have yet to code this myself, so
do not take my advise as law…