Skip to content

Octree: Correct line segment to line segment closest point calculation. - #35216

Merged
Mugen87 merged 1 commit into
mrdoob:devfrom
shan3520:fix/octree-segment-closest-points
Oct 26, 2026
Merged

Mugen87 merged 1 commit into
mrdoob:devfrom
shan3520:fix/octree-segment-closest-points

Conversation

@shan3520

Copy link
Copy Markdown
Contributor

Related issue: n/a

Description

There were two problems in the Octree.js lineToLineClosestPoints() method (involved by triangleCapsuleIntersect() for capsule to triangle edge intersection check): t1 was calculated as ( d * a + e * c ) / divisor where it should have been ( e * c - d * a ) / divisor; and both parameters were separately clamped within range [0, 1]. That made distance calculations incorrect for triangle edges which caused some capsule-to-triangle collisions to be missed, even when the capsule axis intersected the triangle. Correcting the sign of the parameter calculation and recalculating the first one after clamping the second one fixes the problem, makes it equal to brute force segment-to-segment distance calculation and doesn't cause any additional false hits.

@Mugen87
Mugen87 merged commit 68cd790 into mrdoob:dev Oct 26, 2026
9 checks passed
@Mugen87 Mugen87 added this to the r187 milestone Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants