Add helper for OpenTrack input
Contributed by Alberto Pajuelo Montes
This commit is contained in:
parent
713149ceb6
commit
7b16a0cda4
1 changed files with 88 additions and 0 deletions
88
Input/Joysticks/OpenTrack/opentrack-headpose.xml
Normal file
88
Input/Joysticks/OpenTrack/opentrack-headpose.xml
Normal file
|
@ -0,0 +1,88 @@
|
|||
<?xml version="1.0"?>
|
||||
<PropertyList>
|
||||
<nasal>
|
||||
<script>
|
||||
|
||||
var opentrackToAxis = func(jsAxis,viewAxis,axisValue,axisFactor) {
|
||||
var viewNumber = getprop("/sim/current-view/view-number-raw");
|
||||
var viewInitialOffset = getprop("/sim/view["~viewNumber~"]/config/"~viewAxis~"-offset-m");
|
||||
|
||||
if(viewInitialOffset == nil) {
|
||||
viewInitialOffset = 0;
|
||||
}
|
||||
|
||||
setprop("/sim/current-view/"~viewAxis~"-offset-m", viewInitialOffset + ( axisValue * axisFactor ) );
|
||||
}
|
||||
|
||||
</script>
|
||||
</nasal>
|
||||
|
||||
<propiedad type="string">1</propiedad>
|
||||
<name type="string">opentrack headpose</name>
|
||||
<axis n="0">
|
||||
<desc type="string">View X Axis</desc>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
var setting = cmdarg().getNode("setting").getValue();
|
||||
var factor = cmdarg().getNode("factor").getValue();
|
||||
opentrackToAxis(0, "x", setting, factor);
|
||||
</script>
|
||||
<factor type="double">-0.5</factor>
|
||||
<offset type="double">0</offset>
|
||||
</binding>
|
||||
</axis>
|
||||
<axis n="1">
|
||||
<desc type="string">View Y Axis</desc>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
var setting = cmdarg().getNode("setting").getValue();
|
||||
var factor = cmdarg().getNode("factor").getValue();
|
||||
opentrackToAxis(1, "y", setting, factor);
|
||||
</script>
|
||||
<factor type="double">0.5</factor>
|
||||
<offset type="double">0</offset>
|
||||
</binding>
|
||||
</axis>
|
||||
<axis n="2">
|
||||
<desc type="string">View Z Axis</desc>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
var setting = cmdarg().getNode("setting").getValue();
|
||||
var factor = cmdarg().getNode("factor").getValue();
|
||||
opentrackToAxis(2, "z", setting, factor);
|
||||
</script>
|
||||
<factor type="double">0.5</factor>
|
||||
<offset type="double">0</offset>
|
||||
</binding>
|
||||
</axis>
|
||||
<axis n="3">
|
||||
<desc type="string">View Heading Axis</desc>
|
||||
<binding>
|
||||
<command type="string">property-scale</command>
|
||||
<property type="string">/sim/current-view/goal-heading-offset-deg</property>
|
||||
<factor type="double">-180</factor>
|
||||
<offset type="double">0</offset>
|
||||
</binding>
|
||||
</axis>
|
||||
<axis n="4">
|
||||
<desc type="string">View Pitch Axis</desc>
|
||||
<binding>
|
||||
<command type="string">property-scale</command>
|
||||
<property type="string">/sim/current-view/goal-pitch-offset-deg</property>
|
||||
<factor type="double">180</factor>
|
||||
<offset type="double">0</offset>
|
||||
</binding>
|
||||
</axis>
|
||||
<axis n="5">
|
||||
<desc type="string">View Roll Axis</desc>
|
||||
<binding>
|
||||
<command type="string">property-scale</command>
|
||||
<property type="string">/sim/current-view/goal-roll-offset-deg</property>
|
||||
<factor type="double">-180</factor>
|
||||
<offset type="double">0</offset>
|
||||
</binding>
|
||||
</axis>
|
||||
</PropertyList>
|
Loading…
Add table
Reference in a new issue