Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set steeringmanager:rollcontrolanglerange to 180.
- set steeringmanager:rollpid:kp to 0.4.
- set servos to ship:modulesnamed("ModuleRoboticRotationServo").
- for s in servos s:setfield("traverse rate", 10).
- set st to lookdirup(up:vector, facing:topvector).
- lock steering to st.
- set hdg to 90. set sl to 0.
- function tilt { parameter tlt is 0. for s in servos s:setfield("target angle", tlt). }
- list engines in engs.
- function vertThrust {
- set vth to 0.
- for e in engs if e:ignition set vth to vth + vdot(up:vector, e:facing:vector * (choose -1 if e:tag = "reverse" else 1)) * e:availablethrust.
- return max(1,vth).
- }
- on round(time:seconds * 5) { set twr to vertThrust()/ship:mass/body:mu*body:position:sqrmagnitude. return true. }
- set twr to 1.
- lock terAlt to max(0,max(ship:geoposition:terrainheight, body:geopositionof(velocity:surface * 6):terrainheight)).
- lock talt to 20 + terAlt.
- lock vs to max(-30,min(100,((talt^0.8) - (max(0.1,altitude)^0.8)) / 2)).
- set tpid to pidloop(5,0.5, 9, -0.75, 4).
- lock mul to 1 + tpid:update(time:seconds,verticalspeed - vs).
- lock throttle to mul/twr.
- lock tv to heading(hdg,0):vector * sl.
- set tltpid to pidloop(20, 2, 25, -35, 55).
- on round(time:seconds * 12) {
- set relVelVec to vxcl(up:vector, tv - velocity:surface) / 4.
- set relVelVec:mag to min(5,relVelVec:mag).
- tilt(tltpid:update(time:seconds, vdot(facing:topvector, relVelVec))).
- set st to lookdirup(velocity:surface / -500 + up:vector * 10 + vxcl(vxcl(up:vector,facing:topvector),relVelVec),(choose tv * -1 if tv:mag > 2 else facing:topvector)).
- return not(abort).
- }
- set aftE to ship:partstagged("aft")[0].
- when true then {
- set aftE:thrustlimit to choose 0 if tv:mag < 10 else vdot(aftE:facing:vector, tv-velocity:surface) * 30.
- return true.
- }
- stage.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement