Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Outerra Tech Demo download. Help with graphics driver issues

Author Topic: alter flight dynamics from model script ?  (Read 342 times)

fly77

  • Sr. Member
  • ****
  • Posts: 396
alter flight dynamics from model script ?
« 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 ?
« Last Edit: April 29, 2019, 04:20:45 am by fly77 »
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6610
  • Pegs is clever, but tae hain’t a touch sentimental
    • outerra.com
Re: alter flight dynamics from model script ?
« Reply #1 on: April 29, 2019, 06:28:02 am »

There's a jsb() method that returns jsb interface. That one only accepts jsbsim property access, see for example ah64.js script.
Logged

fly77

  • Sr. Member
  • ****
  • Posts: 396
Re: alter flight dynamics from model script ?
« Reply #2 on: April 29, 2019, 08:27:59 am »

wow ! Thanks ! I managed to shut off the engine through the script ! Will have to study JSBSIM now  ;)
Logged

fly77

  • Sr. Member
  • ****
  • Posts: 396
Re: alter flight dynamics from model script ?
« Reply #3 on: May 01, 2019, 11:55:23 am »

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

   
Code: [Select]
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;


« Last Edit: May 01, 2019, 11:58:11 am by fly77 »
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6610
  • Pegs is clever, but tae hain’t a touch sentimental
    • outerra.com
Re: alter flight dynamics from model script ?
« Reply #4 on: May 03, 2019, 02:25:19 am »

You probably need to handle events like "air/engines/on", otherwise the default handlers will set jsbsim properties on their own.
Logged

fly77

  • Sr. Member
  • ****
  • Posts: 396
Re: alter flight dynamics from model script ?
« Reply #5 on: May 03, 2019, 10:22:10 am »

Yes just by registering explicitly the "air/engines/on" event the default handler is disabled and engine no longer switches on automatically. Thanks !  :)
Logged