Merge pull request #2591 from JoePfeiffer/clamp-acceleration
Don't let vertical acceleration be negative before liftoff.
This commit is contained in:
commit
4b2132cc4b
@ -348,9 +348,16 @@ public class RK4SimulationStepper extends AbstractSimulationStepper {
|
|||||||
.getCoriolisAcceleration(status.getRocketWorldPosition(), status.getRocketVelocity());
|
.getCoriolisAcceleration(status.getRocketWorldPosition(), status.getRocketVelocity());
|
||||||
linearAcceleration = linearAcceleration.add(store.coriolisAcceleration);
|
linearAcceleration = linearAcceleration.add(store.coriolisAcceleration);
|
||||||
|
|
||||||
// If still on the launch rod, project acceleration onto launch rod direction and
|
// If we haven't taken off yet, don't sink into the ground
|
||||||
// set angular acceleration to zero.
|
if (!status.isLiftoff()) {
|
||||||
if (!status.isLaunchRodCleared()) {
|
angularAcceleration = Coordinate.NUL;
|
||||||
|
if (linearAcceleration.z < 0) {
|
||||||
|
linearAcceleration = Coordinate.ZERO;
|
||||||
|
}
|
||||||
|
} else if (!status.isLaunchRodCleared()) {
|
||||||
|
|
||||||
|
// If still on the launch rod, project acceleration onto launch rod direction and
|
||||||
|
// set angular acceleration to zero.
|
||||||
|
|
||||||
linearAcceleration = store.launchRodDirection.multiply(linearAcceleration.dot(store.launchRodDirection));
|
linearAcceleration = store.launchRodDirection.multiply(linearAcceleration.dot(store.launchRodDirection));
|
||||||
angularAcceleration = Coordinate.NUL;
|
angularAcceleration = Coordinate.NUL;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user