Update water material collision detection logic in JavaScript

This commit is contained in:
2026-04-07 10:37:59 +02:00
parent 12fe38c268
commit a171f26988

View File

@@ -583,7 +583,7 @@ export function collectWaterContactPatches(volume, contactBounds, patchLimit = M
maxZ = Math.max(maxZ, localPoint.z); maxZ = Math.max(maxZ, localPoint.z);
} }
if (maxX <= -halfX || minX >= halfX || maxZ <= -halfZ || minZ >= halfZ) { if (maxX < -halfX || minX > halfX || maxZ < -halfZ || minZ > halfZ) {
continue; continue;
} }
@@ -593,7 +593,7 @@ export function collectWaterContactPatches(volume, contactBounds, patchLimit = M
const clippedFootprint = clipPolygonToRectangle(buildConvexHull(localCorners.map((corner) => new Vector2(corner.x, corner.z))), -halfX, halfX, -halfZ, halfZ); const clippedFootprint = clipPolygonToRectangle(buildConvexHull(localCorners.map((corner) => new Vector2(corner.x, corner.z))), -halfX, halfX, -halfZ, halfZ);
if (calculatePolygonArea(clippedFootprint) <= WATER_CONTACT_EPSILON) { if (clippedFootprint.length < 2) {
continue; continue;
} }