fix(map): align path preview with terrain projection

This commit is contained in:
Tom Boullay
2026-05-25 17:54:57 +02:00
parent 4f8355e934
commit 2b08665508
3 changed files with 13 additions and 5 deletions
+2 -2
View File
@@ -91,8 +91,8 @@ export function terrainSurfaceUvFromXZ(
): TerrainSurfaceUv {
const width = bounds.maxX - bounds.minX;
const depth = bounds.maxZ - bounds.minZ;
let u = width === 0 ? 0 : (x - bounds.minX) / width;
let v = depth === 0 ? 0 : (z - bounds.minZ) / depth;
let u = width === 0 ? 0 : x / width + 0.5;
let v = depth === 0 ? 0 : z / depth + 0.5;
if (projection?.flipX) {
u = 1 - u;