Friday, July 1, 2022
HomeGame Developmentunity - Discover closest level inside the *overlap* of two colliders

unity – Discover closest level inside the *overlap* of two colliders


Easy query which most likely has a sophisticated reply.

Utilizing Collider.ClosestPoint, I can discover the purpose on a given collider that’s closest to a given level.

However let’s imagine I’ve two colliders that I do know are overlapping, like this:
overlapping colliders

The overlap of those colliders, by their nature, kinds a closed form. I would like to have the ability to apply Collider.ClosestPoint to this overlapping space, as if it had been a collider. I need to discover the closest level that’s inside the overlapping house of the 2 colliders.

Within the above instance, I am utilizing easy capsule colliders, however in the actual deal I might be utilizing MeshColliders with extra advanced shapes. It looks as if MeshCollider.ClosestPoint mainly does what I want: taking an arbitrary form (a mesh) and discovering the closest level on it, however on this case I haven’t got a mesh.

The closest I may get to fixing this, in principle, could be to by some means create a mesh from the overlap of the colliders, then use MeshCollider.ClosestPoint. However I do not know scorching to create such a mesh.

Any concepts?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments