Closed Larkinabout closed 6 months ago
Same error seems to happen for gridded, although the distance tracking and elevation control also bugs out so there may be wider issues with gridded and the 'Prefer Token Elevation' option:
It's possible to resolve by checking whether elevationAtWaypoint(this.waypoints[this.waypoints.length - 1])
will resolve to a number. Though I'm not sure whether it should be resolve somewhere else by setting _terrainElevation
in the absence of other elevation sources.
Nevertheless, here's the potential fix:
export function terrainElevationAtPoint(p, { startingElevation } = {}) {
const measuringToken = this._getMovementToken();
const waypointElevation = (this.waypoints.length) ? elevationAtWaypoint(this.waypoints[this.waypoints.length - 1] : null;
startingElevation ??= isFinite(waypointElevation)
? waypointElevation : measuringToken
? tokenElevation(measuringToken) : Number.NEGATIVE_INFINITY;
return elevationAtLocation(p, measuringToken, startingElevation);
}
Should be fixed in v0.8.3. Thanks! I refactored quite a bit of the terrain elevation code, which was quite old at this point.
Elevation Ruler 0.8.2 Foundry VTT 11.315 dnd5e 2.4.1
The error is thrown with the token update in![image](https://github.com/caewok/fvtt-elevation-ruler/assets/105953297/3c57cdba-0795-4634-9113-7803754a226d)
_animateSegment
due tosegment.ray.B.z
having a value of 'NaN'. I haven't been able to spend enough time with the code to work back to wheresegment.ray.B.z
is written.