Kerbal Space Program  1.12.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Classes
VesselPrecalculate.cs File Reference

Classes

class  VesselPrecalculate
 This is the counterpart to FlightIntegrator. As FI runs after most other FixedUpdate things run and finally applies all physics changes for the frame prior to passing off to the integrator, this runs at the start of the frame and precalculates the values for the fixed frame, like CoM, vessel velocity and angular velocity, the force of gravity (and any drift compensation), vessel acceleration/G forces, and the like. It also will set position and rotation when on rails, or if off rails recompute the orbit based on those stats calculated. It handles being off rails specially: it will do its final update for any given UT in Update() rather than FixedUpdate() so the calculated pos/vel/etc stats for the vessel are correct for visual display. When on rails, nothing changes in PhysX integration so there is no need to run later. Note that so long as this is running, it tells the vessel's OrbitDriver not to do anything, and instead directly calls OrbitDriver's Update methods. This is because when off rails, orbit updating needs to occur after we determine vessel CoM and velocity, whereas when on rails, we need to update from the orbit before we calculate CoM and velocity. More...