Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ship:dockingports[0]:controlfrom().
- rcs on.
- set steeringmanager:rollcontrolanglerange to 180.
- set servos to ship:modulesnamed("ModuleRoboticRotationServo").
- function tilt { parameter tlt is 0. for s in servos if s:hasfield("target angle") s:setfield("target angle", tlt). }
- for en in ship:engines en:shutdown().
- set vectors to ship:partsdubbedpattern("vector").
- for vec in vectors vec:activate().
- function vertThrust {
- set vth to 0. for e in vectors set vth to vth + vdot(up:vector, e:facing:vector) * 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 * 15):terrainheight)).
- lock talt to 50 + terAlt.
- lock vs to max(-30,min(100,((talt^0.8) - (max(0.1,altitude)^0.8)) / 2)).
- set tpid to pidloop(2,0.6, 0.3, -0.75, 4).
- lock mul to 1 + tpid:update(time:seconds,verticalspeed - vs).
- set steeringmanager:rollpid:kp to 0.4.
- for s in servos if s:hasfield("tranverse rate") s:setfield("traverse rate", 10).
- set tltpid to pidloop(10,0.5, 15, -30, 65).
- if not (defined tar) set tar to target.
- lock tarpos to choose tar if tar:istype("vector") else tar:position.
- Lock steering to lookdirup(up:vector, -tarpos).
- lock throttle to mul/twr.
- lock maxspeed to 0.
- lock tv to tarpos:normalized * min(min(maxspeed, (airspeed + 1)* 2),(tarpos:mag/6) ^ 0.85).
- when true then {
- set relVelVec to vxcl(up:vector, tv - velocity:surface) / 3.5.
- set relVelVec:mag to min(10,relVelVec:mag).
- tilt(tltpid:update(time:seconds, vdot(facing:topvector, relVelVec))).
- return true.
- }
- lock steering to lookdirup(up:vector * 10 + vxcl(vxcl(up:vector,facing:topvector),relVelVec),-tarpos).
- clearscreen.
- Print "set maxspeed to continue".
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement