this.shape = this.collision.correctPosition(this.shape);
this.force = this.collision.correctForce(this.force);
this.velocity = this.collision.correctVelocity(this.velocity);
// Neue Geschwindigkeit bestimmen
Vector acceleration = this.force.div(this.mass);
Vector deltaVelocity = acceleration.mul(this.oldStep);
this.velocity = this.velocity.add(deltaVelocity);
// Begrenze die Geschwindigkeit
if (this.velocity.x > AbstractObject.MAXIMUM_VELOCITY_ONE_WAY) {
this.velocity = this.velocity
.modifyX(AbstractObject.MAXIMUM_VELOCITY_ONE_WAY);
} else if (this.velocity.x < -AbstractObject.MAXIMUM_VELOCITY_ONE_WAY) {
this.velocity = this.velocity
.modifyX(-AbstractObject.MAXIMUM_VELOCITY_ONE_WAY);
}
if (this.velocity.y > AbstractObject.MAXIMUM_VELOCITY_ONE_WAY) {
this.velocity = this.velocity
.modifyY(AbstractObject.MAXIMUM_VELOCITY_ONE_WAY);
} else if (this.velocity.y < -AbstractObject.MAXIMUM_VELOCITY_ONE_WAY) {
this.velocity = this.velocity
.modifyY(-AbstractObject.MAXIMUM_VELOCITY_ONE_WAY);
}
// Entsprechend die neue Position berechnen
Vector newPos = this.shape.getCenter().add(
this.velocity.mul(this.oldStep));
// Neues Shape bestimmen
NextShape newShape = this.shape.modifyCenter(newPos);
this.oldShape = this.shape;