RAF_Mk9_bubble_sextant: Adapted to the new mouse movement handling.
This commit is contained in:
parent
71980707f3
commit
8b4393735d
2 changed files with 160 additions and 131 deletions
|
@ -43,42 +43,44 @@ var toggle_look_through = func {
|
|||
###############################################################################
|
||||
# Bindings for mouse X and Y movements. Install these to the appropriate
|
||||
# mouse mode and axes, e.g. in the -set file.
|
||||
var mouseX = func {
|
||||
var mouseXmove = func {
|
||||
if (!_initialized or !handling.enabled) return;
|
||||
if(__kbd.alt.getValue()) {
|
||||
var delta = 3*cmdarg().getNode("offset").getValue();
|
||||
if(__kbd.shift.getValue() and handling.enabled) {
|
||||
# Roll adjustment
|
||||
var orient = sextant.get_orientation();
|
||||
var roll = orient[2] - delta;
|
||||
if(roll < -180) roll = -180;
|
||||
if(roll > 180) roll = 180;
|
||||
sextant.set_orientation(orient[0], orient[1], roll);
|
||||
} else {
|
||||
var view = "/sim/current-view/heading-offset-deg";
|
||||
var val = getprop(view) - delta;
|
||||
if(val < 0) val = 0;
|
||||
if(val > 360) val = 360;
|
||||
setprop(view, val);
|
||||
}
|
||||
}
|
||||
|
||||
var delta = 3*cmdarg().getNode("offset").getValue();
|
||||
var view = "/sim/current-view/heading-offset-deg";
|
||||
var val = getprop(view) - delta;
|
||||
if(val < 0) val = 0;
|
||||
if(val > 360) val = 360;
|
||||
setprop(view, val);
|
||||
}
|
||||
var mouseXtilt = func {
|
||||
if (!_initialized or !handling.enabled) return;
|
||||
|
||||
var delta = 3*cmdarg().getNode("offset").getValue();
|
||||
# Roll adjustment
|
||||
var orient = sextant.get_orientation();
|
||||
var roll = orient[2] - delta;
|
||||
if(roll < -180) roll = -180;
|
||||
if(roll > 180) roll = 180;
|
||||
sextant.set_orientation(orient[0], orient[1], roll);
|
||||
}
|
||||
|
||||
var mouseY = func {
|
||||
var mouseYmove = func {
|
||||
if (!_initialized or !handling.enabled) return;
|
||||
if(__kbd.alt.getValue()) {
|
||||
var delta = 3*cmdarg().getNode("offset").getValue();
|
||||
if(__kbd.shift.getValue() and handling.enabled) {
|
||||
# Altitude adjustment
|
||||
sextant.adjust_altitude_fine(delta);
|
||||
} else {
|
||||
var view = "/sim/current-view/pitch-offset-deg";
|
||||
var val = getprop(view) - delta;
|
||||
if(val < -90) val = -90;
|
||||
if(val > 90) val = 90;
|
||||
setprop(view, val);
|
||||
}
|
||||
}
|
||||
|
||||
var delta = 3*cmdarg().getNode("offset").getValue();
|
||||
var view = "/sim/current-view/pitch-offset-deg";
|
||||
var val = getprop(view) - delta;
|
||||
if(val < -90) val = -90;
|
||||
if(val > 90) val = 90;
|
||||
setprop(view, val);
|
||||
}
|
||||
var mouseYaltitude = func {
|
||||
if (!_initialized or !handling.enabled) return;
|
||||
|
||||
var delta = 3*cmdarg().getNode("offset").getValue();
|
||||
# Altitude adjustment
|
||||
sextant.adjust_altitude_fine(delta);
|
||||
}
|
||||
|
||||
var RAD = math.pi/180;
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
Bubble sextant for Celestial Navigation in FlightGear
|
||||
-----------------------------------------------------
|
||||
|
||||
Copyright 2007 - 2010 Anders Gidenstam
|
||||
Copyright (C) 2007 - 2013 Anders Gidenstam
|
||||
|
||||
* These programs are free software; you can redistribute them and/or modify
|
||||
* them under the terms of the GNU General Public License as published by
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
|
@ -24,121 +24,40 @@ much better, though, so have a look there both for introduction and more
|
|||
advanced topics.
|
||||
|
||||
|
||||
Part 0 - Installing the tools: 3d bubble sextant model for FlightGear
|
||||
---------------------------------------------------------------------
|
||||
|
||||
- The bubble sextant 3d model RAF_Mk9_bubble_sextant.xml need to be
|
||||
loaded from the aircraft 3d model file and placed at the center of
|
||||
the view it is intended to be used from. For example for a view located
|
||||
2.5 meter behind and 2.0 meter above the aircraft origin:
|
||||
(Note that any offsets of the main 3d model needs to be accounted for
|
||||
in translating the view position to a 3d model position and that the
|
||||
axes order differs.)
|
||||
|
||||
<!-- Star observer's instruments -->
|
||||
<model>
|
||||
<name>Bubble_sextant</name>
|
||||
<path>Aircraft/Short_Empire/Instruments/BubbleSextant/RAF_Mk9_bubble_sextant.xml</path>
|
||||
<offsets>
|
||||
<x-m> 2.50 </x-m>
|
||||
<y-m> 0.50 </y-m>
|
||||
<z-m> 2.00 </z-m>
|
||||
</offsets>
|
||||
</model>
|
||||
|
||||
- The Nasal module needs to be loaded from the main aircraft -set file.
|
||||
The name of the view in which the sextant will be used and
|
||||
the stowed (= inactive) location of the instrument needs to be set.
|
||||
The stored location is specified in a frame axis parallel with the
|
||||
aircraft frame but centered at the location given for the sextant
|
||||
3d model in the 3d model file.
|
||||
For example:
|
||||
<nasal>
|
||||
<RAFmk9sextant>
|
||||
<file>Aircraft/Short_Empire/Instruments/BubbleSextant/RAF_Mk9_bubble_sextant.nas</file>
|
||||
<script>
|
||||
var VIEW_NAME = "Star Observation View";
|
||||
var STOWED = { position : {x:-0.3, y: 0.0, z: -0.2},
|
||||
orientation : {heading : 320.0,
|
||||
pitch : -45.0,
|
||||
roll : 0.0}
|
||||
};
|
||||
</script>
|
||||
</RAFmk9sextant>
|
||||
</nasal>
|
||||
|
||||
- To allow fine control of the sextant using the mouse add the following
|
||||
XML snippet to the aircraft's -set file.
|
||||
It binds moves movements in mode 0/pointer mode to the sextant.
|
||||
alt + move mouse - precision movement of view direction.
|
||||
alt + shift + move mouse - up/down changes the altitude setting of the
|
||||
sextant.
|
||||
- left/right tilts the sextant to align with
|
||||
the horizon.
|
||||
|
||||
<input>
|
||||
<!-- Install the sextant controls in mouse mode 0. -->
|
||||
<mice n="0">
|
||||
<mouse n="0">
|
||||
<mode n="0">
|
||||
<x-axis>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
RAFmk9sextant.mouseX();
|
||||
</script>
|
||||
</binding>
|
||||
</x-axis>
|
||||
<y-axis>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
RAFmk9sextant.mouseY();
|
||||
</script>
|
||||
</binding>
|
||||
</y-axis>
|
||||
</mode>
|
||||
</mouse>
|
||||
</mice>
|
||||
</input>
|
||||
|
||||
|
||||
To correctly measure the altitude of a heavenly body the instrument
|
||||
must be level, i.e. the bubble must be centered.
|
||||
The instrument is configured for an aim-then-level method, i.e.
|
||||
one first center the view on the desired object then change the altitude
|
||||
and tilt settings until the instrument is level. (I.e. changing altitude
|
||||
behaves as if the user changes the setting and rotates the instrument so
|
||||
that it remains aimed in the same direction).
|
||||
|
||||
NOTE: Tilting of the instrument might still be somewhat buggy.
|
||||
|
||||
|
||||
Part 1 - Taking sextant sights in FlightGear
|
||||
-------------------------------------
|
||||
--------------------------------------------
|
||||
|
||||
What is needed?
|
||||
- The celestial altitude (~angle from the horizon) for some (at least 2)
|
||||
stars and the precise time of observation.
|
||||
- An aircraft with the RAF mk9 bubble sextant instrument.
|
||||
Short_Empire is one such aircraft.
|
||||
|
||||
- Using the sextant one needs to measure and record the celestial altitude
|
||||
(~angle from the horizon) for some (at least 2) stars and the precise time
|
||||
of observation.
|
||||
|
||||
How?
|
||||
|
||||
- For the Short_Empire: Go to the copilot view.
|
||||
|
||||
- Pick up the sextant by clicking on either of its handles.
|
||||
|
||||
- For the Short_Empire: move (using w,a,d,s) to the observation hatch
|
||||
and open it by clicking on it.
|
||||
|
||||
- Enter the sextant view by clicking on the sextant eye piece.
|
||||
|
||||
- Obtain a bubble by turning the bubble knob on the left side of
|
||||
the instrument. It is possible to reach the bubble knob while in
|
||||
sextant view.
|
||||
|
||||
- Aim the center of the view on the star. Alt + move mouse in pointer mode
|
||||
- Aim the center of the view on the star. Shift + move mouse in pointer mode
|
||||
enables high precision view rotation.
|
||||
|
||||
- Level the instrument. This is done by changing the altitude setting,
|
||||
first in 10 degree steps by the coarse motion knob on the right side
|
||||
of the instrument (reachable also while in sextant view) and then
|
||||
with the slow motion knob (or alt+shift+move mouse up/down).
|
||||
Tilt the instrument (alt+shift+move mouse right/left) as needed to
|
||||
with the slow motion knob (or shift+ctrl+move mouse up/down).
|
||||
Tilt the instrument (shift+ctrl+move mouse right/left) as needed to
|
||||
center the bubble.
|
||||
|
||||
- Time + celestial altitude constitutes a sighting. Make sure that
|
||||
|
@ -182,6 +101,114 @@ The Intercept method
|
|||
Further info and plotting sheets: http://www.efalk.org/Navigation/
|
||||
|
||||
|
||||
|
||||
Appendix - Installing the tools: 3d bubble sextant model for FlightGear
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
- The bubble sextant 3d model RAF_Mk9_bubble_sextant.xml need to be
|
||||
loaded from the aircraft 3d model file and placed at the center of
|
||||
the view it is intended to be used from. For example for a view located
|
||||
2.5 meter behind and 2.0 meter above the aircraft origin:
|
||||
(Note that any offsets of the main 3d model needs to be accounted for
|
||||
in translating the view position to a 3d model position and that the
|
||||
axes order differs.)
|
||||
|
||||
<!-- Star observer's instruments -->
|
||||
<model>
|
||||
<name>Bubble_sextant</name>
|
||||
<path>Aircraft/Instruments-3d/RAF_Mk9_bubble_sextant/RAF_Mk9_bubble_sextant.xml</path>
|
||||
<offsets>
|
||||
<x-m> 2.50 </x-m>
|
||||
<y-m> 0.50 </y-m>
|
||||
<z-m> 2.00 </z-m>
|
||||
</offsets>
|
||||
</model>
|
||||
|
||||
- The Nasal module needs to be loaded from the main aircraft -set file.
|
||||
The name of the view in which the sextant will be used and
|
||||
the stowed (= inactive) location of the instrument needs to be set.
|
||||
The stored location is specified in a frame axis parallel with the
|
||||
aircraft frame but centered at the location given for the sextant
|
||||
3d model in the 3d model file.
|
||||
For example:
|
||||
<nasal>
|
||||
<RAFmk9sextant>
|
||||
<file>Aircraft/Instruments-3d/RAF_Mk9_bubble_sextant/RAF_Mk9_bubble_sextant.nas</file>
|
||||
<script>
|
||||
var VIEW_NAME = "Star Observation View";
|
||||
var STOWED = { position : {x:-0.3, y: 0.0, z: -0.2},
|
||||
orientation : {heading : 320.0,
|
||||
pitch : -45.0,
|
||||
roll : 0.0}
|
||||
};
|
||||
</script>
|
||||
</RAFmk9sextant>
|
||||
</nasal>
|
||||
|
||||
- To allow fine control of the sextant using the mouse add the following
|
||||
XML snippet to the aircraft's -set file.
|
||||
It binds moves movements in mode 0/pointer mode to the sextant.
|
||||
alt + move mouse - precision movement of view direction.
|
||||
alt + shift + move mouse - up/down changes the altitude setting of the
|
||||
sextant.
|
||||
- left/right tilts the sextant to align with
|
||||
the horizon.
|
||||
|
||||
<input>
|
||||
<!-- Install the sextant controls in mouse mode 0. -->
|
||||
<mice n="0">
|
||||
<mouse n="0">
|
||||
<mode n="0">
|
||||
<x-axis-shift>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
RAFmk9sextant.mouseXmove();
|
||||
</script>
|
||||
</binding>
|
||||
</x-axis-shift>
|
||||
<x-axis-ctrl-shift>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
RAFmk9sextant.mouseXtilt();
|
||||
</script>
|
||||
</binding>
|
||||
</x-axis-ctrl-shift>
|
||||
<y-axis-shift>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
RAFmk9sextant.mouseYmove();
|
||||
</script>
|
||||
</binding>
|
||||
</y-axis-shift>
|
||||
<y-axis-ctrl-shift>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
RAFmk9sextant.mouseYaltitude();
|
||||
</script>
|
||||
</binding>
|
||||
</y-axis-ctrl-shift>
|
||||
</mode>
|
||||
</mouse>
|
||||
</mice>
|
||||
</input>
|
||||
|
||||
|
||||
To correctly measure the altitude of a heavenly body the instrument
|
||||
must be level, i.e. the bubble must be centered.
|
||||
The instrument is configured for an aim-then-level method, i.e.
|
||||
one first center the view on the desired object then change the altitude
|
||||
and tilt settings until the instrument is level. (I.e. changing altitude
|
||||
behaves as if the user changes the setting and rotates the instrument so
|
||||
that it remains aimed in the same direction).
|
||||
|
||||
NOTE: Tilting of the instrument might still be somewhat buggy.
|
||||
|
||||
|
||||
|
||||
References
|
||||
----------
|
||||
|
||||
|
|
Loading…
Reference in a new issue