> as I told to Andy Ross I would like to implement a truck driving simulation
> in FlightGear but my doubt regards the collision detection, which is not
> implemented! It's only a week that I study FlightGear code and I have now
> no idea if the collision detection is reasonably implementable or not and,
> if yes, how.
> I would appreciate your opinions.
That depends on how you define "reasonably". If you aren't familiar with 3D
programming then it might not be reasonable. But it can be done. Take a look
at the hitlist code in the Scenery directory to get an idea of what is being
tested now and how. Currently we get a "ground elevation" value by running
intersection test of a perpendicular vector from the aircraft to the scenery
below (you can drill down from the ground elevation call in the main
loop--src/Main/main.cxx--if you prefer).
Such tests can be done in any direction you want, and you don't need to do
the test in every direction every frame (the direction you are traveling in
might be most important :-)). You can extrapolate results if you know the
shape and size of the object and or the shape and size of the vehicle (e.g.
you might know that if the center bumper is less than 0.5m away from a wall
the corner must have hit). You can also do tests from multiple points on the
vehicle. And you can zero in on objects of concern (test more often)
depending on their distance and the speed/direction of the vehicle.
The FDM's might be doing something roughly similar based on attitude of the
aircraft and the altitude above ground level only. I don't think they have
enough detail to do what you describe. You will need to build a subsystem to
do something like what I've described above. AFAIK it does not yet exist.
Flightgear-devel mailing list