hey there,
I have a Skeleton Hand here which consists of a fingers where each finger has 3 discrete capsule colliders to model the bones. What I am trying now is, to compute the closestpoints on the front bone of the index finger to an interaction object which has a convex mesh collider. More precisely spoken, I want to compute the closest Points between the index bone collider and the interaction object collider.
Vector3 objectSurfacePoint = _InteractionObject.GetComponent<MeshCollider>().ClosestPoint(_IndexBone.transform.position);
Vector3 boneSurfacePoint = _IndexBone.GetComponent<Collider>().ClosestPoint(objectSurfacePoint);
Debug.DrawLine(boneSurfacePoint, objectSurfacePoint);
Using primitive Objects like a Cube or Sphere worked already like a charm without any unexpected behavior. But since I am trying to use the same method with a convex mesh collider the MeshCollider.ClosestPoint() seems to fail hard in alot of cases.
However, according to the docs it should work also with convex meshcolliders, so I dont know why it fails that hard here. It also fails when I use a convex mesh collider and inflate the meshcollider again to an actual box collider.
I put some screenshots to make it more clear how it behaves and how it misses the actual closest Surface Point on the collider. A green line marks a reasonable result, where a red line Fails.
Any ideas? Thanks alot