Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Download Outerra Tech Demo. Unofficial Outerra Discord server, MicroProse Discord server for OWS.

Author Topic: Airspeed Table  (Read 8688 times)

Levi

  • Hero Member
  • *****
  • Posts: 585
    • Outerra Mods Site!
Airspeed Table
« on: July 07, 2014, 05:32:57 am »

I'm not sure if this is the correct section to ask this, but here it goes.  :D

Well, I noticed that default Cessna uses some kind of table for the airspeed indicator. I haven't use any table for the Basler because the space between numbers do not vary, so there's no need for tables, like this:


But now I have to use an indicator similar used on Cessna with varying spaces between numbers, like this one:


So, the question is, How was that table created? Was that made by hand?
And if it was made by hand, is there a easy way, or any trick to make the needle match precisely with the background texture?

I'm talking about this table:
Code: [Select]
const airspeed_tbl = [
  0.0,   0.0,   0.0,  10.0,  30.0,  50.0,  70.0,  90.0, 113.0, 138.0,
    162.0, 185.0, 208.0, 224.0, 240.0, 254.0, 268.0, 280.0, 292.0, 305.0,
    318.0, 331.0, 344.0, 357.0 ];

Thanks :)
Logged

PytonPago

  • Hero Member
  • *****
  • Posts: 2284
  • It´s way too complex, dont let me try to explain !
Re: Airspeed Table
« Reply #1 on: July 07, 2014, 05:58:22 am »

You could add a multiplier to the variable after a certain number reached :

Code: [Select]
var airspeed = "actual speed value in knots",

var airneedle = airspeed,

const airbreach = 90,

const airindmultiplayer = 2,

if (airspeed > airbreach) (

airneedle = ( airbreach + ( ( airspeed - airbreach ) / airindmultiplayer ) )

)

.....

this.geom.rotate_joint_orig(this.airneedleobj, airneedle, {x:1,y:0,z:0});

...


I gave the multiplayer to "/ 2" cause it seems the scale is twice smaller after 90 knots. Also, you dont have to define everything as i did and just give the numbers just to the function in the IF. I just made it this way to better see what was done ...
« Last Edit: July 07, 2014, 06:00:58 am by PytonPago »
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

Levi

  • Hero Member
  • *****
  • Posts: 585
    • Outerra Mods Site!
Re: Airspeed Table
« Reply #2 on: July 07, 2014, 07:19:43 am »

Thanks a lot PytonPago! It works perfectly, and its much simpler than using those tables  ;D

Logged

PytonPago

  • Hero Member
  • *****
  • Posts: 2284
  • It´s way too complex, dont let me try to explain !
Re: Airspeed Table
« Reply #3 on: July 07, 2014, 08:07:16 am »

There is always something simple behind stuff.  ;D

  The tables arent a bad thing. Aldo, you can do more complex stuff be this "IF" method, but certain things can prove to be better done in tables, so it wouldnt be bad to look into them too ... seeing forward for the front-panel scripted version ! Also, if ya dont have the fuel-indicator sorted out yet, you can look at my newest version ural script and do something similar, but depended only on the throttle state.
« Last Edit: July 07, 2014, 08:10:54 am by PytonPago »
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

Levi

  • Hero Member
  • *****
  • Posts: 585
    • Outerra Mods Site!
Re: Airspeed Table
« Reply #4 on: July 07, 2014, 10:05:57 am »

Your method worked very well having only two scales, but I need more scales, e.g. from 0-20; 20-90; 90-200, and some in between that needed some tweaks. I tried doing this by "IF" method with no luck. So I decided to take a closer look at that table, and I finally figured it out! It's much simpler(and useful) than I thought. Also the rotation degrees from the table are the same in 3ds Max, and that saved time!

This is my custom table. The numbers(in 3ds Max degrees) increases by every 10 KNOTS.
Code: [Select]
const airspeed_tbl =
  [0.0, 5.0, 10.0,  37.0,  63.0,  90.0,  117.0,  143.5, 170.0,
  196.5, 208.5, 220.5, 232.5, 244.5 ,256.0, 268.0, 280.0, 292.0, 304.5, 316.0,
    328.5];

And this is the rest of the script:
Code: [Select]
val = jsb['velocities/vc-kts']/10;
var idx = Math.floor(val);
if(idx >= airspeed_tbl.length - 2) idx = airspeed_tbl.length - 2;
val = airspeed_tbl[idx] + (airspeed_tbl[idx + 1] - airspeed_tbl[idx]) * (val - idx);
if((val)>=329){val = 329;}   //<<<<<<<------------------------------------------I added this line to lock the needle to 200kts when you exceed the speed
geom.rotate_joint_orig(asi_needle_left, deg2rad(val), {x:0,y:0,z:-1});
geom.rotate_joint_orig(asi_needle_right, deg2rad(val), {x:0,y:0,z:-1});
geom.rotate_joint_orig(asi_needle_back, deg2rad(val), {x:0,y:0,z:-1});

As for the fuel indicator, it's much simpler with aircrafts, basically, the fuel consumption is calculated internally by JSBSim, and you only have to link it with the indicator, and of course indicate the capacity and content of each fuel tank in FDM.

This is the property to access to each fuel tank: propulsion/tank[0]/contents-lbs

Btw, if you look closer to Basler's script , you can see that the fuel needles actually indicates the fuel quantity of each tank (it has 6 tanks in total ;D).
Logged

PytonPago

  • Hero Member
  • *****
  • Posts: 2284
  • It´s way too complex, dont let me try to explain !
Re: Airspeed Table
« Reply #5 on: July 07, 2014, 10:21:09 am »

Nice - thanks for the script ... maybe it will be for some use for me !  ;)
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.