This commit is contained in:
Schluffe
2026-04-14 21:39:59 +02:00
parent 910c2bb435
commit 9b75d41bea
3 changed files with 27 additions and 15 deletions
+5 -5
View File
@@ -6,6 +6,7 @@ import {
createVector,
getDotProduct,
invScale,
scale,
type Vector,
} from "#/engine/Vector.ts";
@@ -527,9 +528,9 @@ export function moveAndSlide(
break;
}
const scale = Math.max(0, time - 0.001);
position.x += velocity.x * delta * timeLeft * scale;
position.y += velocity.y * delta * timeLeft * scale;
const scalar = Math.max(0, time - 0.001) * delta * timeLeft;
position.x += velocity.x * scalar;
position.y += velocity.y * scalar;
const dot = getDotProduct(velocity, closest.normal);
velocity.x -= closest.normal.x * dot;
@@ -538,6 +539,5 @@ export function moveAndSlide(
timeLeft *= 1 - time;
}
velocity.x *= timeLeft;
velocity.y *= timeLeft;
scale(velocity, timeLeft);
}