Francesco BRISA (& me): add teleport function
When holding the gear key or button down (as a kind of modifier) and after left-clicking on the terrain, teleport the UFO to the click position. Keep heading if no model is active, otherise look there. Keep altitude-agl.
This commit is contained in:
parent
7c5bd888ac
commit
67b14bb1ae
2 changed files with 20 additions and 0 deletions
|
@ -107,6 +107,10 @@
|
|||
<name>Alt + mouse click</name>
|
||||
<desc>move selected object(s) to new place</desc>
|
||||
</key>
|
||||
<key>
|
||||
<name>g (gear) + click</name>
|
||||
<desc>teleport to click position, looking at active object</desc>
|
||||
</key>
|
||||
<key>
|
||||
<name>Ctrl + PgUp/PgDn</name>
|
||||
<desc>cycle through model list</desc>
|
||||
|
|
|
@ -4,6 +4,10 @@ setlistener("/sim/panel/visibility", func(n) {
|
|||
}, 1);
|
||||
|
||||
|
||||
var gear_key_down = 0;
|
||||
controls.gearDown = func (x) gear_key_down = x != 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -319,6 +323,9 @@ var ModelMgr = {
|
|||
status_dialog.open();
|
||||
adjust_dialog.center_sliders();
|
||||
|
||||
if (gear_key_down)
|
||||
return teleport(mouse_coord, me.active);
|
||||
|
||||
if (KbdAlt.getBoolValue()) { # move active object here (and other selected ones along with it)
|
||||
(me.active == nil) and return;
|
||||
var course = me.active.pos.course_to(me.mouse_coord);
|
||||
|
@ -592,6 +599,15 @@ var print_model_data = func(prop) {
|
|||
}
|
||||
|
||||
|
||||
var teleport = func(target, lookat) {
|
||||
setprop("/position/latitude-deg", target.lat());
|
||||
setprop("/position/longitude-deg", target.lon());
|
||||
setprop("/position/altitude-ft", target.alt() * geo.M2FT + getprop("/position/altitude-agl-ft"));
|
||||
view.resetView();
|
||||
if (lookat != nil)
|
||||
setprop("/orientation/heading-deg", target.course_to(lookat.pos));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue