Add node execution code.
This commit is contained in:
parent
34ddc42b37
commit
e0d1c34b46
6 changed files with 71 additions and 26 deletions
|
@ -1,6 +1,30 @@
|
|||
// functions for calculating steering values.
|
||||
@lazyglobal off.
|
||||
|
||||
function GetPitch {
|
||||
parameter v is SHIP:FACING:FOREVECTOR.
|
||||
return 90 - vectorangle(SHIP:UP:FOREVECTOR, v).
|
||||
}
|
||||
|
||||
function CreateCircularizationNode {
|
||||
parameter usePeriapsis is false.
|
||||
local target is SHIP:ORBIT:APOAPSIS.
|
||||
local t is SHIP:ORBIT:ETA:APOAPSIS.
|
||||
if usePeriapsis {
|
||||
set target to SHIP:ORBIT:PERIAPSIS.
|
||||
set t to SHIP:ORBIT:ETA:PERIAPSIS.
|
||||
}
|
||||
local n is Node(t, 0, 0, 0).
|
||||
|
||||
// move fast until we pass our target.
|
||||
until (usePeriapsis and n:ORBIT:APOAPSIS < target) or n:ORBIT:PERIAPSIS > target {
|
||||
set n:PROGRADE to n:PROGRADE + 1.
|
||||
}
|
||||
|
||||
// now bring it back in real slow until we come back.
|
||||
until (usePeriapsis and n:ORBIT:APOAPSIS > target) or n:ORBIT:PERIAPSIS < target {
|
||||
set n:PROGRADE to n:PROGRADE - 0.01.
|
||||
}
|
||||
|
||||
return n.
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue