fix tests

This commit is contained in:
2026-05-25 21:00:15 +02:00
parent 25ff3c56c5
commit 9e36c13635
3 changed files with 28 additions and 8 deletions

View File

@@ -91,9 +91,11 @@ void MovementIntentSystem::tick(EntityAdmin& admin)
const float manAccel = body.maneuveringAccelerationPerTick;
const float stoppingDist = (body.maxSpeedPerTick * body.maxSpeedPerTick)
/ (2.0f * manAccel);
const float desiredSpeed = (dist <= stoppingDist)
// Cap to dist so the ship never overshoots the target in a single tick.
const float baseDesiredSpeed = (dist <= stoppingDist)
? std::sqrt(2.0f * manAccel * dist)
: body.maxSpeedPerTick;
const float desiredSpeed = std::min(dist, baseDesiredSpeed);
const QVector2D desiredVel = delta.normalized() * desiredSpeed;
const QVector2D velError = desiredVel - body.velocity;