Outerra forum
User mods, screenshots & videos => Aircraft => Topic started by: fly77 on April 29, 2019, 02:42:49 am
-
I'd like to simulate damage or mass changes of a plane through a javascript model file. Is it possible to set the JBSIM parameters programmatically from a script to modify the flight physics during the game ?
Or is it possible in another way to apply extra forces on a plane model ? The this.extra_force command does not seem to work on planes. Any possible hack ?
-
There's a jsb() method that returns jsb interface. That one only accepts jsbsim property access, see for example ah64.js script.
-
wow ! Thanks ! I managed to shut off the engine through the script ! Will have to study JSBSIM now ;)
-
I am trying to disable possibility to start the engine inside the script... to model a heavily damaged plane..
In update frame I tried to set to zero everything that seems related with engine and propulsion...and when on ground set wheelspeed to zero....nothing else is there in update frame ...but still when I press "E" key the plane briefly sets on to move. The "b" key for brake works still but how to set "brake" in the script for the plane...there seems to be no "brake" property in the FDM files
jsb['propulsion/engine[0]/set-running']=0;
jsb['propulsion/starter_cmd']=0;
jsb['fcs/starter-cmd-norm[0]']=0;
jsb['fcs/throttle-cmd-norm']=0;
jsb['fcs/throttle-pos-norm[0]']=0;
jsb['fcs/mixture-cmd-norm']=0;
jsb['propulsion/engine[0]/engine-rpm']=0;
jsb['propulsion/engine[0]/propeller-rpm']=0;
jsb['propulsion/engine[0]/thrust-lbs']=0;
jsb['gear/unit[0]/wheel-speed-fps']=0;
jsb['gear/unit[1]/wheel-speed-fps']=0;
jsb['gear/unit[2]/wheel-speed-fps']=0;
-
You probably need to handle events like "air/engines/on", otherwise the default handlers will set jsbsim properties on their own.
-
Yes just by registering explicitly the "air/engines/on" event the default handler is disabled and engine no longer switches on automatically. Thanks ! :)
-
Sorry, since the advent of grass I've been away for a while...
The best way to damage an engine would be to adjust the cooling effect on the engine, like an oil or coolant leak...
This can be done in real time via a jsbsim property.... If you build a flight model with both coolant and oil tanks and then removed their content over time based on their damage level and adjusted the cooling value based on their fill percentage you'd have a very realistic outcome.
"cooling-factor (Advanced) this number models how efficient the aircraft cooling system is."
Regards
Simon.
-
Thanks for the suggestion bomber. I guess the JSBSIM property "propulsion/engine[0]/oil-pressure-psi" could be one such parameter.
But how to edit the Heinkel FDM to include oil-pressure-psi effect ? Do you know where and how it should be included ?
In
propulsion.xml ?
-
The property to use would be
propulsion/engine[0]/cooling-factor
Just reduce it to zero at full damage and let jsbsim internal code sieze the engine up.
-
OK will try to implement this and other ideas ...such as aerodynamic damage to wings....in a future version of the Heinkel or maybe Potez : any other suggestions are wellcome.