Fixed ghost track rotation on rear ends

Recalculation on track edit end
Changes rendering of ties to be evenly spaced
Fixes ghost and held track rendering
This commit is contained in:
2025-02-15 06:40:39 -07:00
parent 3befb69f51
commit 968867c5d9
6 changed files with 73 additions and 41 deletions

View File

@@ -237,10 +237,10 @@ export class PathSegment {
resolution = 1,
targetLength?: number,
) {
const points: Vector[] = [];
const points: [Vector, number][] = [];
points.push(this.points[0]);
let prev = points[0];
points.push([this.points[0], this.tangent(0).heading()]);
let [prev] = points[0];
let distSinceLastEvenPoint = 0;
let t = 0;
@@ -258,7 +258,7 @@ export class PathSegment {
Vector.sub(point, prev).normalize().mult(overshoot),
);
distSinceLastEvenPoint = overshoot;
points.push(evenPoint);
points.push([evenPoint, this.tangent(t).heading()]);
prev = evenPoint;
}
@@ -278,7 +278,7 @@ export class PathSegment {
Vector.sub(point, prev).normalize().mult(overshoot),
);
distSinceLastEvenPoint = overshoot;
points.push(evenPoint);
points.push([evenPoint, this.tangent(t).heading()]);
prev = evenPoint;
}
@@ -304,7 +304,7 @@ export class PathSegment {
const curveLength = this.startingLength;
const points = this.calculateEvenlySpacedPoints(1, 1, curveLength + 1);
if (points.length >= curveLength) {
this.points[3].set(points[curveLength]);
this.points[3].set(points[curveLength][0]);
}
}