diff --git a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java index 0ba86fb4c..fd864e789 100644 --- a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java +++ b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java @@ -130,12 +130,16 @@ public class BasicEventSimulationEngine implements SimulationEngine { double oldAlt = currentStatus.getRocketPosition().z; if (SimulationListenerHelper.firePreStep(currentStatus)) { - // Step at most to the next event. If there is no next event, don't step time - double maxStepTime = 0.0; + // Step at most to the next event + double maxStepTime = Double.MAX_VALUE; FlightEvent nextEvent = currentStatus.getEventQueue().peek(); + if (nextEvent != null) { maxStepTime = MathUtil.max(nextEvent.getTime() - currentStatus.getSimulationTime(), 0.001); + } else if (currentStatus.isLanded()) { + maxStepTime = 0.0; } + log.trace("Taking simulation step at t=" + currentStatus.getSimulationTime() + " altitude " + oldAlt); currentStepper.step(currentStatus, maxStepTime); }