* Melchior FRANZ -- Wednesday 19 November 2008: > See the attached example [...]
Which can now also be written shorter, now that I've added an "add-model" fgcommand. There's no need to search for a free slot and to set/remove the "load" property any more. One could always define a model by setting the <models><model> branch in the *-set.xml file. But as with all fgcommands, one can now also use "add-model" in a binding. (Not that I have a meaningful use case for that :-). <binding> <command>add-model</command> <path>Models/Fauna/cow.ac</path> <latitude-deg>37.62887558</latitude-deg> <longitude-deg>-122.39002720</longitude-deg> <elevation-m>0.9106</elevation-m> </binding> Here's a revised version of the follow_the_cow script: var data = "/sim/model/cow/"; fgcommand("add-model", props.Node.new({ "path": "Models/Fauna/cow.ac", "latitude-deg-prop": data ~ "latitude-deg", "longitude-deg-prop": data ~ "longitude-deg", "elevation-ft-prop": data ~ "altitude-ft", "heading-deg-prop": data ~ "heading-deg", "pitch-deg-prop": data ~ "pitch-deg", "roll-deg-prop": data ~ "roll-deg", })); var update_model = func { var heading = getprop("/orientation/heading-deg"); var pitch = getprop("/orientation/pitch-deg"); var roll = getprop("/orientation/roll-deg"); var ac = geo.aircraft_position(); ac.apply_course_distance(heading, 10); setprop(data ~ "latitude-deg", ac.lat()); setprop(data ~ "longitude-deg", ac.lon()); setprop(data ~ "altitude-ft", ac.alt() * geo.M2FT); setprop(data ~ "heading-deg", heading + 180); setprop(data ~ "pitch-deg", -pitch); setprop(data ~ "roll-deg", -roll); settimer(update_model, 0); } update_model(); m. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel