I have been trying to implement cockpit shaking into the An-124 but I have no idea why my Nasal script is not doing anything, I know it works because I tried manually toggling it through the property browser. It is supposed to use the "gear-compression-norm" property for the front gears to determine when it will trigger the cockpit shake which I borrowed from the 727. Does this have something to do with the fact that it is an Yasim aircraft and the 727 is an JSBSim aircraft? Here is the code
- Code: Select all
var shakeEffectB727 = props.globals.initNode("/systems/shake/effect",0,"BOOL");
var shakeB727 = props.globals.initNode("/systems/shake/shaking",0,"DOUBLE");
var rSpeed = 0;
var sf = 0;
var n_g_c = 0;
var n_g_l = 0;
var n_g_r = 0;
var theShakeEffect = func{
n_g_c = getprop("/gear/gear[0]/compression-norm") or 0;
n_g_l = getprop("/gear/gear[1]/compression-norm") or 0;
n_g_r = getprop("/gear/gear[2]/compression-norm") or 0;
rSpeed = getprop("/gear/gear[0]/rollspeed-ms") or 0;
sf = rSpeed / 94000;
if (shakeEffectB727.getBoolValue() and (n_g_c > 0 or n_g_l > 0 or n_g_r > 0)) {
interpolate("/systems/shake/shaking", sf, 0.03);
settimer(func {
interpolate("/systems/shake/shaking", -sf * 2, 0.03);
}, 0.06);
settimer(func {
interpolate("/systems/shake/shaking", sf, 0.03);
}, 0.12);
settimer(theShakeEffect, 0.09);
} else {
setprop("/systems/shake/shaking", 0);
setprop("/systems/shake/effect",0);
}
}
setlistener("/systems/shake/effect", func(state){
if(state.getBoolValue()){
theShakeEffect();
}
}, 1, 0);