Fix: Correct door alignment for East and West walls

- Fixed wallOffset calculation for E/W walls
- Both E and W walls need inverted offset due to rotation=π/2
- Local X axis points to -Z for both walls when rotated 90°
- Door gaps and door meshes now perfectly aligned on all walls (N/S/E/W)
- Resolves misalignment issue where E/W doors didn't match their wall gaps
This commit is contained in:
2025-12-28 20:12:32 +01:00
parent 8025d66fc4
commit 5852a972f4

View File

@@ -919,15 +919,18 @@ function getDoorWorldPosition(room, door, centerX, centerZ, halfSizeX, halfSizeZ
meshPos.z = doorWorldPos.z;
rotation = Math.PI / 2;
// Offset relativo al centro de la pared
wallOffset = doorWorldPos.z - centerZ;
// Con rotation=π/2, el eje X local apunta hacia -Z, entonces:
// offset_local = -(doorZ - centerZ)
wallOffset = -(doorWorldPos.z - centerZ);
break;
case 'W':
// Pared Oeste: puerta alineada en Z, X en el borde oeste
meshPos.x = centerX - halfSizeX;
meshPos.z = doorWorldPos.z;
rotation = Math.PI / 2;
// Para pared Oeste, el offset es directo (sin inversión)
wallOffset = doorWorldPos.z - centerZ;
// Con rotation=π/2, el eje X local apunta hacia -Z (igual que pared E)
// Por tanto, también necesita offset invertido
wallOffset = -(doorWorldPos.z - centerZ);
break;
}