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:
12
math/path.ts
12
math/path.ts
@@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user