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