Skip to content

Commit b6c5be2

Browse files
authored
Merge pull request #9472 from darax/patch-1
Avoid calling Physics.ClosestPoint on non-convex collider
2 parents 16a6d6b + 47376ef commit b6c5be2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Assets/MRTK/SDK/Features/UX/Scripts/Pointers/SpherePointer.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,13 @@ public bool TryUpdateQueryBufferForLayerMask(LayerMask layerMask, Vector3 pointe
449449
for (int i = 0; i < numColliders; i++)
450450
{
451451
Collider collider = queryBuffer[i];
452+
MeshCollider meshCollider = collider as MeshCollider;
453+
if (meshCollider != null && meshCollider.convex == false)
454+
{
455+
// Physics.ClosestPoint is only allowed on a convex collider.
456+
continue;
457+
}
458+
452459
grabbable = collider.GetComponent<NearInteractionGrabbable>();
453460
if (grabbable != null)
454461
{

0 commit comments

Comments
 (0)