rotorwash.nas 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. var rotor_wash_loop = func {
  2. ##### water and grass shader effect
  3. var vpos = geo.viewer_position();
  4. var apos = geo.aircraft_position();
  5. var lat_to_m = 110952.0;
  6. var lon_to_m = math.cos(apos.lat()*math.pi/180.0) * lat_to_m;
  7. var alt = getprop("/position/altitude-agl-ft");
  8. var delta_x = (apos.lat() - vpos.lat()) * lat_to_m;
  9. var delta_y = -(apos.lon() - vpos.lon()) * lon_to_m;
  10. setprop("/environment/aircraft-effects/wash-x", delta_x);
  11. setprop("/environment/aircraft-effects/wash-y", delta_y);
  12. var rpm_factor = getprop("rotors/main/rpm")/280.0;
  13. var strength = 20.0/alt;
  14. if (strength > 1.0) {strength = 1.0;}
  15. strength = strength * rpm_factor;
  16. setprop("/environment/aircraft-effects/wash-strength", strength);
  17. #particle effect colors
  18. var land = getprop("/gear/gear/ground-is-solid");
  19. var red_diffuse = getprop("/rendering/scene/diffuse/red");
  20. if (land) {
  21. setprop("/sim/model/bo105/effects/particles/rotorwash/redcombinedstart", red_diffuse*.4);
  22. setprop("/sim/model/bo105/effects/particles/rotorwash/greencombinedstart", red_diffuse*.4);
  23. setprop("/sim/model/bo105/effects/particles/rotorwash/bluecombinedstart", red_diffuse*.4);
  24. setprop("/sim/model/bo105/effects/particles/rotorwash/redcombinedend", red_diffuse*.7);
  25. setprop("/sim/model/bo105/effects/particles/rotorwash/greencombinedend", red_diffuse*.7);
  26. setprop("/sim/model/bo105/effects/particles/rotorwash/bluecombinedend", red_diffuse*.7);
  27. } else {
  28. setprop("/sim/model/bo105/effects/particles/rotorwash/redcombinedstart", red_diffuse*.65);
  29. setprop("/sim/model/bo105/effects/particles/rotorwash/greencombinedstart", red_diffuse*.80);
  30. setprop("/sim/model/bo105/effects/particles/rotorwash/bluecombinedstart", red_diffuse*.75);
  31. setprop("/sim/model/bo105/effects/particles/rotorwash/redcombinedend", red_diffuse*.85);
  32. setprop("/sim/model/bo105/effects/particles/rotorwash/greencombinedend", red_diffuse*1);
  33. setprop("/sim/model/bo105/effects/particles/rotorwash/bluecombinedend", red_diffuse*.90);
  34. }
  35. settimer( func { rotor_wash_loop(); }, 0);
  36. }
  37. rotor_wash_loop();