Nasal library/geo: Difference between revisions

Jump to navigation Jump to search
→‎Functions: Doc put_model()
m (→‎normdeg(): Fix typo)
(→‎Functions: Doc put_model())
Line 371: Line 371:


=== put_model() ===
=== put_model() ===
{{Nasal doc
|syntax = geo.put_model(path, lat, lon[, elev[, hdg[, pitch[, roll]]]]);
geo.put_model(path, coord[, hdg[, pitch[, roll]]]]);
|text = Places a model in the simulation at a given location and orientation. If successful, returns the model's root property as a <code>props.Node</code> object.
|param1 = path
|param1text = Path to the model as a string.
|param2 = lat
|param2text = Latitude coordinate.
|param3 = lon
|param3text = Longitude coordinate.
|param4 = elev
|param4text = Optional altitude. Defaults to <code>'''nil'''</code>, in which case the model will be placed on the terrain. Note that an error will be thrown if the terrain's elevation cannot be found, e.g., if there is no scenery tile loaded at the location.
|param5 = coord
|param5text = A <code>geo.Coord</code> instance, which, if given, replaces '''lat''', '''lon''' and '''elev'''.
|param6 = hdg
|param6text = Optional model heading. Defaults to 0.
|param7 = pitch
|param7text = Optional model pitch. Defaults to 0.
|param8 = roll
|param8text = Optional model roll. Defaults to 0.
|example1 = var path = "Models/Geometry/glider.ac";
var coord = geo.aircraft_position();
var course = getprop("/orientation/heading-deg");
coord.apply_course_distance(course, 100); # Model to be added 100 m ahead
var model = geo.put_model(path, coord, course); # Place the default glider
|example2 = var path = "Models/Geometry/glider.ac";
var coord = geo.aircraft_position();
coord.apply_course_distance(getprop("/orientation/heading-deg"), 100); # model to be added 100 m ahead
var model = geo.put_model(path, coord.lat(), coord.lon(), coord.alt(), 0, 45, 50); # Place the default glider
}}
=== tile_index() ===
=== tile_index() ===
=== tile_path() ===
=== tile_path() ===

Navigation menu