WIP
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user