Multiplay: Fix turning indicator. FDM: avoid sinking.

This commit is contained in:
Sidi Liang 2019-07-27 10:45:56 +08:00
parent 2a05e82bc4
commit 8ea07c42a7
6 changed files with 214 additions and 23 deletions

View File

@ -6,12 +6,6 @@
<load>
var livery_update = aircraft.livery_update.new("Aircraft/followme_e-tron/Models/Messages");
var liveryFuse_update = followme.liveryFuse_update.new("Aircraft/followme_e-tron/Models/Texture");
var rplayer = cmdarg();
# Set up property aliases for animations.
rplayer.getNode("/controls/lighting/indicator-left", 1).
alias(rplayer.getNode("sim/multiplay/generic/float[0]"));
rplayer.getNode("/controls/lighting/indicator-right", 1).
alias(rplayer.getNode("sim/multiplay/generic/float[1]"));
</load>
<unload>
livery_update.stop();
@ -447,7 +441,7 @@
<red>1.0</red>
<green>0.8</green>
<blue>0.2</blue>
<factor-prop>sim/model/lights/indicator-left/state</factor-prop>
<factor-prop>sim/multiplay/generic/int[0]</factor-prop>
</emission>
</animation>
@ -458,7 +452,7 @@
<red>1.0</red>
<green>0.8</green>
<blue>0.2</blue>
<factor-prop>sim/model/lights/indicator-right/state</factor-prop>
<factor-prop>sim/multiplay/generic/int[1]</factor-prop>
</emission>
</animation>

View File

@ -52,7 +52,30 @@ var update_engine = func(){
}
var force = 3.33*direction*torque*gearratio;
#print("torque:"~torque);
props.getNode("/",1).setValue("/fdm/jsbsim/external_reactions/engine/magnitude", force);
if(props.getNode("/",1).getValue("/fdm/jsbsim/gear/unit/compression-ft") > 0){
props.getNode("/",1).setValue("/fdm/jsbsim/external_reactions/FL/magnitude", force/4);
}else{
props.getNode("/",1).setValue("/fdm/jsbsim/external_reactions/FL/magnitude", 0);
}
if(props.getNode("/",1).getValue("/fdm/jsbsim/gear/unit/compression-ft") > 0){
props.getNode("/",1).setValue("/fdm/jsbsim/external_reactions/FR/magnitude", force/4);
}else{
props.getNode("/",1).setValue("/fdm/jsbsim/external_reactions/FR/magnitude", 0);
}
if(props.getNode("/",1).getValue("/fdm/jsbsim/gear/unit/compression-ft") > 0){
props.getNode("/",1).setValue("/fdm/jsbsim/external_reactions/BL/magnitude", force/4);
}else{
props.getNode("/",1).setValue("/fdm/jsbsim/external_reactions/BL/magnitude", 0);
}
if(props.getNode("/",1).getValue("/fdm/jsbsim/gear/unit/compression-ft") > 0){
props.getNode("/",1).setValue("/fdm/jsbsim/external_reactions/BR/magnitude", force/4);
}else{
props.getNode("/",1).setValue("/fdm/jsbsim/external_reactions/FR/magnitude", 0);
}
}
var engineTimer = maketimer(0.001, update_engine);
@ -78,6 +101,7 @@ var startEngine = func(){
props.getNode("/",1).setValue("/controls/engines/engine/started",1);
props.getNode("/",1).setValue("/systems/electrical/e-tron/switch/bat-fwd-eng",1);
props.getNode("/",1).setValue("/systems/electrical/e-tron/switch/bat-bwd-eng",1);
engineTimer.simulatedTime = 1;
engineTimer.start();
print("Engine started");
}

View File

@ -23,7 +23,7 @@ var liveryFuse_update = {
aircraft.livery.init("Aircraft/followme_e-tron/Models/Messages");
liveryFuse.init("Aircraft/followme_e-tron/Models/Texture");
props.getNode("/",1).setValue("/systems/horn",0);
props.getNode("/",1).setValue("/systems/horn",false);
var frontleft_door = aircraft.door.new("/controls/doors/frontleft", 1);
var frontright_door = aircraft.door.new("/controls/doors/frontright", 1);

View File

@ -44,12 +44,12 @@
<path>Aircraft/followme_e-tron/Sounds/horn.wav</path>
<condition>
<equals>
<property>/systems/horn</property>
<property>sim/multiplay/generic/int[2]</property>
<value>1</value>
</equals>
</condition>
<volume>
<property>/systems/horn</property>
<property>sim/multiplay/generic/int[2]</property>
<factor>5</factor>
</volume>
</horn>

View File

@ -151,7 +151,14 @@
</menu>
</default>
</menubar>
<multiplay>
<generic>
<int n="0" alias="/sim/model/lights/indicator-left/state"/>
<int n="1" alias="/sim/model/lights/indicator-right/state"/>
<int n="2" alias="/systems/horn"/>
</generic>
</multiplay>
</sim>
<engines>
@ -175,12 +182,7 @@
</lighting>
</controls>
<multiplay>
<generic>
<int n="0" alias="/controls/lighting/indicator-left"/>
<int n="1" alias="/controls/lighting/indicator-right"/>
</generic>
</multiplay>
<input>
<keyboard>

View File

@ -109,6 +109,141 @@
<brake_group> RIGHT </brake_group>
<retractable>0</retractable>
</contact>
<contact type="STRUCTURE" name="Bottom1">
<location unit="M">
<x> 0</x>
<y> 0</y>
<z>0.3</z>
</location>
<static_friction> 1.0 </static_friction>
<dynamic_friction> 0.4 </dynamic_friction>
<rolling_friction> 0.4 </rolling_friction>
<spring_coeff unit="LBS/FT"> 8000 </spring_coeff>
<damping_coeff unit="LBS/FT/SEC"> 5000 </damping_coeff>
<max_steer unit="DEG"> 0.0 </max_steer>
<brake_group> NONE </brake_group>
<retractable> 0 </retractable>
</contact>
<contact type="STRUCTURE" name="Bottom2">
<location unit="M">
<x> 3.7</x>
<y> 0</y>
<z>0.3</z>
</location>
<static_friction> 1.0 </static_friction>
<dynamic_friction> 0.4 </dynamic_friction>
<rolling_friction> 0.4 </rolling_friction>
<spring_coeff unit="LBS/FT"> 8000 </spring_coeff>
<damping_coeff unit="LBS/FT/SEC"> 5000 </damping_coeff>
<max_steer unit="DEG"> 0.0 </max_steer>
<brake_group> NONE </brake_group>
<retractable> 0 </retractable>
</contact>
<contact type="STRUCTURE" name="Top1">
<location unit="M">
<x> 0</x>
<y> 0</y>
<z>0.89</z>
</location>
<static_friction> 1.0 </static_friction>
<dynamic_friction> 0.4 </dynamic_friction>
<rolling_friction> 0.4 </rolling_friction>
<spring_coeff unit="LBS/FT"> 8000 </spring_coeff>
<damping_coeff unit="LBS/FT/SEC"> 5000 </damping_coeff>
<max_steer unit="DEG"> 0.0 </max_steer>
<brake_group> NONE </brake_group>
<retractable> 0 </retractable>
</contact>
<contact type="STRUCTURE" name="Top2">
<location unit="M">
<x> 3.65</x>
<y> 0</y>
<z>1.75</z>
</location>
<static_friction> 1.0 </static_friction>
<dynamic_friction> 0.4 </dynamic_friction>
<rolling_friction> 0.4 </rolling_friction>
<spring_coeff unit="LBS/FT"> 8000 </spring_coeff>
<damping_coeff unit="LBS/FT/SEC"> 5000 </damping_coeff>
<max_steer unit="DEG"> 0.0 </max_steer>
<brake_group> NONE </brake_group>
<retractable> 0 </retractable>
</contact>
<contact type="STRUCTURE" name="display">
<location unit="M">
<x> 3.40</x>
<y> 0</y>
<z>1.96</z>
</location>
<static_friction> 1.0 </static_friction>
<dynamic_friction> 0.4 </dynamic_friction>
<rolling_friction> 0.4 </rolling_friction>
<spring_coeff unit="LBS/FT"> 8000 </spring_coeff>
<damping_coeff unit="LBS/FT/SEC"> 5000 </damping_coeff>
<max_steer unit="DEG"> 0.0 </max_steer>
<brake_group> NONE </brake_group>
<retractable> 0 </retractable>
</contact>
<contact type="STRUCTURE" name="Wing1">
<location unit="M">
<x> 2.12</x>
<y> 0.8</y>
<z>0.9</z>
</location>
<static_friction> 1.0 </static_friction>
<dynamic_friction> 0.4 </dynamic_friction>
<rolling_friction> 0.4 </rolling_friction>
<spring_coeff unit="LBS/FT"> 8000 </spring_coeff>
<damping_coeff unit="LBS/FT/SEC"> 5000 </damping_coeff>
<max_steer unit="DEG"> 0.0 </max_steer>
<brake_group> NONE </brake_group>
<retractable> 0 </retractable>
</contact>
<contact type="STRUCTURE" name="Wing2">
<location unit="M">
<x> 2.12</x>
<y>-0.8</y>
<z>0.9</z>
</location>
<static_friction> 1.0 </static_friction>
<dynamic_friction> 0.4 </dynamic_friction>
<rolling_friction> 0.4 </rolling_friction>
<spring_coeff unit="LBS/FT"> 8000 </spring_coeff>
<damping_coeff unit="LBS/FT/SEC"> 5000 </damping_coeff>
<max_steer unit="DEG"> 0.0 </max_steer>
<brake_group> NONE </brake_group>
<retractable> 0 </retractable>
</contact>
<contact type="STRUCTURE" name="Mirror1">
<location unit="M">
<x> 1.25</x>
<y>0.94</y>
<z>1.05</z>
</location>
<static_friction> 1.0 </static_friction>
<dynamic_friction> 0.4 </dynamic_friction>
<rolling_friction> 0.4 </rolling_friction>
<spring_coeff unit="LBS/FT"> 8000 </spring_coeff>
<damping_coeff unit="LBS/FT/SEC"> 5000 </damping_coeff>
<max_steer unit="DEG"> 0.0 </max_steer>
<brake_group> NONE </brake_group>
<retractable> 0 </retractable>
</contact>
<contact type="STRUCTURE" name="Mirror1">
<location unit="M">
<x> 1.25</x>
<y>-0.94</y>
<z>1.05</z>
</location>
<static_friction> 1.0 </static_friction>
<dynamic_friction> 0.4 </dynamic_friction>
<rolling_friction> 0.4 </rolling_friction>
<spring_coeff unit="LBS/FT"> 8000 </spring_coeff>
<damping_coeff unit="LBS/FT/SEC"> 5000 </damping_coeff>
<max_steer unit="DEG"> 0.0 </max_steer>
<brake_group> NONE </brake_group>
<retractable> 0 </retractable>
</contact>
</ground_reactions>
<propulsion>
@ -169,11 +304,47 @@
</aerodynamics>
<external_reactions>
<force name="engine" frame="BODY">
<force name="FL" frame="BODY">
<location unit="M">
<x> 1.5</x>
<y> 0</y>
<z> 0</z>
<x> 0.68</x>
<y>-0.66</y>
<z>-0.02</z>
</location>
<direction>
<x>1</x>
<y>0</y>
<z>0</z>
</direction>
</force>
<force name="FR" frame="BODY">
<location unit="M">
<x> 0.68</x>
<y> 0.66</y>
<z>-0.02</z>
</location>
<direction>
<x>1</x>
<y>0</y>
<z>0</z>
</direction>
</force>
<force name="BL" frame="BODY">
<location unit="M">
<x> 3.17</x>
<y>-0.66</y>
<z>-0.03</z>
</location>
<direction>
<x>1</x>
<y>0</y>
<z>0</z>
</direction>
</force>
<force name="BR" frame="BODY">
<location unit="M">
<x> 3.17</x>
<y> 0.66</y>
<z>-0.03</z>
</location>
<direction>
<x>1</x>