I was reading in CineFX that they used a cool script on the ailerons and flaps for Pearl Harbor. It would check 10 frames ahead for the roll and adjust ailerons accordingly. So I'm trying to recreate something similar for my demo reel. I'm looking for any suggestions on the script - ways to streamline it. I'm fairly new to MEL and am sure there are redundancies and better ways to do this. Any help would be great..Thanks
------START SCRIPT--------
cycleCheck -e off;
int $magnitude;
float $diff;
float $currentbank;
float $futurebank;
int $advtime;
$advtime = frame + 10;
$currentbank = X_248.rotateZ;
$futurebank = getAttr -t $advtime X\_248.rz;
$diff = (abs ($futurebank - $currentbank));
if (($diff > 1) && ($diff < 5))
$magnitude = 1;
else if (($diff > 5) && ($diff < 10))
$magnitude = 4;
else if (($diff > 10) && ($diff < 15))
$magnitude = 7;
else if ($diff > 15)
$magnitude = 10;
else
$magnitude = 0;
if ($futurebank > $currentbank)
setAttr X_248.Ailerons $magnitude;
else if ($futurebank < $currentbank)
setAttr X_248.Ailerons (-$magnitude);
---------END SCRIPT----------------