2018-07-27 17:23:38 +02:00
|
|
|
@LAZYGLOBAL OFF.
|
|
|
|
|
2018-07-19 14:42:03 +02:00
|
|
|
// 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".
|
2018-08-05 19:40:16 +02:00
|
|
|
lock actual_prograde to SHIP:srfprograde.
|
2018-07-19 14:42:03 +02:00
|
|
|
} else {
|
|
|
|
print "Switched actual_prograde to orbit PROGRADE".
|
2018-08-05 19:40:16 +02:00
|
|
|
lock actual_prograde to SHIP:prograde.
|
2018-07-19 14:42:03 +02:00
|
|
|
}
|
|
|
|
return true. // preserve trigger
|
|
|
|
}
|
|
|
|
on NAVMODE {return set_actual_prograde().}
|
|
|
|
set_actual_prograde().
|
|
|
|
|
|
|
|
|
2019-02-08 22:19:26 +01:00
|
|
|
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
|
|
|
|
).
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-07-19 14:42:03 +02:00
|
|
|
// ANGLES
|
2018-08-05 19:40:16 +02:00
|
|
|
lock actual_prograde_pitch to vang(actual_prograde:vector, UP:vector).
|
2018-07-19 14:42:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-26 04:06:14 +02:00
|
|
|
// // 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
|