From: Frederic B. <fre...@fr...> - 2009-05-20 14:30:14
|
----- "Melchior FRANZ" a écrit : > * Frederic Bouvier -- Tuesday 19 May 2009: > > Maybe we could distinguish terrain and models in the traversal mask ? > > For the moment, every solid models has the terrain bit. Then geo.elevation() > > could accept a parameter that tells if it search terrain or solid objects. > > geo.elevation() is just a convenience wrapper for geodinfo(). And > while that can't be limited to search only for terrain *or* objects, it is > already possible to determine whether a returned elevation was that of an > object or of terrain. Just add this code somewhere: > > var loop = func { > var ac = geo.aircraft_position(); > debug.dump(geodinfo(ac.lat(), ac.lon(), ac.alt())); > settimer(loop, 1); > } > loop(); > > ... then fly along with the UFO. You'll get one set of > geod(etic)info(rmation) > at the UFO's coordinates per second. There are three different kinds > of responses: > > 1: nil > > 2: [0.5990206304960102, { load_resistance: 1e+30, friction_factor: > 1, \ > names: ['pa_dspl_thresh'], solid: 1, bumpiness: 0, > rolling_friction: 0.02, \ > light_coverage: 0 }] > 3: [10.13547897298338, nil] > > The first is with no terrain or object below, the second is with > terain below, > and the third is with an object below (no terrain data!). So you can > also easily > see if you are under something: just test from your current altitude > and from > 100000 m altitude. If the former returns terrain and the latter an > object, then > you are in/under something. So if you really want to hit the floor and not the top of objects you can iterate with different starting height until the second member is not nil ? -Fred -- Frédéric Bouvier http://my.fotolia.com/frfoto/ Photo gallery - album photo http://fgsd.sourceforge.net/ FlightGear Scenery Designer |