// Interpolate between current and target orientation over the duration public override void Update(double elapsedTime, SpaceCraftBase spaceCraft) { DVector2 prograde = spaceCraft.GetRelativeVelocity(); prograde.Normalize(); double retrogradeAngle = prograde.Angle(); double adjustRatio = (elapsedTime - StartTime) / _adjustmentTime; if (adjustRatio > 1) { spaceCraft.SetPitch(retrogradeAngle); } else { double interpolatedAdjust = _curentOrientation * (1 - adjustRatio) + retrogradeAngle * adjustRatio; spaceCraft.SetPitch(interpolatedAdjust); } }
// Interpolate between current and target orientation over the duration public override void Update(double elapsedTime, SpaceCraftBase spaceCraft) { double ratio = (elapsedTime - StartTime) / Duration; spaceCraft.SetPitch(_currentOrientation * (1 - ratio) + _targetOrientation * ratio); }
public override void Finalize(SpaceCraftBase spaceCraft) { spaceCraft.SetPitch(_targetOrientation); }