run tfDirToUnitV( Up ). set uVec to tfUnit. set vVec to velocity:orbit.
// The math is less wildly swingy when using // numbers closer to zero, so converting // orbital velocity into a unit vector here. // (Alternatively, you could run // tfDirToUnitV( prograde ). // to obtain the velocity unit vector in the // global variable tfUnit .) // set vMag to ( ((vVec:x)^2)+((vVec:y)^2)+((vVec:z)^2) )^0.5 . set vUnitX to (vVec:x) / vMag. set vUnitY to (vVec:y) / vMag. set vUnitZ to (vVec:z) / vMag.
// Cross Product of up and velocity // gives a vector normal to the orbital // plane. Don't bother collecting the XYZ // parts into a vector as I need to keep // using them seperately anyway: set normX to (vUnitY)*(uVec:z) - (vUnitZ)*(uVec:y) . set normY to (vUnitZ)*(uVec:x) - (vUnitX)*(uVec:z) . set normZ to (vUnitX)*(uVec:y) - (vUnitY)*(uVec:x) .
// Now the vectors: set norm to V(normX,normY,normZ). set antiNorm to V( 0-normX, 0-normY, 0-normZ ).
// Inclination can be obtained from the dot product // of the normal vector and the SOI body's axis: // Since we're dealing with unit vectors here, and // the direction of the SOI body's axis is always // the Y axis, as in V(0,1,0), most of the terms // of that dot product cancel out and we're left // with just this simple calculation: set inc to arccos( normY ).
print " ". print " norm is " + norm. print "antiNorm is " + antiNorm. print "My inclination from body's equator is: " + inc . print " ". print "Now try typing either of the following: ". print " lock steering to R(0,0,0) + norm. ". print " lock steering to R(0,0,0) + antiNorm. ". print "To set your steering.". print " ".