@LAZYGLOBAL OFF. // Define actual_prograde, which automatically switches from SHIP:SRFPROGRADE to SHIP:PROGRADE local function set_actual_prograde { if NAVMODE = "SURFACE" { print "Switched actual_prograde to surface SRFPROGRADE". lock actual_prograde to SHIP:srfprograde. } else { print "Switched actual_prograde to orbit PROGRADE". lock actual_prograde to SHIP:prograde. } return true. // preserve trigger } on NAVMODE {return set_actual_prograde().} set_actual_prograde(). function vdraw { parameter vector. // vector or function. For example, pass {return UP:vector.} to automatically update the draw parameter text is "". parameter color is RED. parameter start is V(0,0,0). // same as vector vecdraw( start, vector, color, text, 5.0, // scale true, // show 0.05 // width ). } // ANGLES lock actual_prograde_pitch to vang(actual_prograde:vector, UP:vector). // // the following are all vectors, mainly for use in the roll, pitch, and angle of attack calculations // lock rightrotation to ship:facing*r(0,90,0). // lock right to rightrotation:vector. //right and left are directly along wings // lock left to (-1)*right. // lock up to ship:up:vector. //up and down are skyward and groundward // lock down to (-1)*up. // lock fore to ship:facing:vector. //fore and aft point to the nose and tail // lock aft to (-1)*fore. // lock righthor to vcrs(up,fore). //right and left horizons // lock lefthor to (-1)*righthor. // lock forehor to vcrs(righthor,up). //forward and backward horizons // lock afthor to (-1)*forehor. // lock top to vcrs(fore,right). //above the cockpit, through the floor // lock bottom to (-1)*top. // // the following are all angles, useful for control programs // lock absaoa to vang(fore,srfprograde:vector). //absolute angle of attack // lock aoa to vang(top,srfprograde:vector)-90. //pitch component of angle of attack // lock sideslip to vang(right,srfprograde:vector)-90. //yaw component of aoa // lock rollangle to vang(right,righthor)*((90-vang(top,righthor))/abs(90-vang(top,righthor))). //roll angle, 0 at level flight // lock pitchangle to vang(fore,forehor)*((90-vang(fore,up))/abs(90-vang(fore,up))). //pitch angle, 0 at level flight // lock glideslope to vang(srfprograde:vector,forehor)*((90-vang(srfprograde:vector,up))/abs(90-vang(srfprograde:vector,up))). // lock ascentangle to vang(srfprograde:vector, forehor). //angle of surface prograde above horizon