Hi,
I’d like to know what is the closest point from an object to another one. (see image)
I’ve tried several things, but none returns the expected result.
A. I’ve tried to find the closest vertex.
It works perfectly on little objects, but not on very big ones (see image) with few vertices, like a wall.
This is not a perfect solution.
B. I’ve tried to get the distance to the center of the object (very often used for LOD systems) but it’s not working at all with big objects.
The solution would be to break big objects into more little ones.
But I want to find another solution.
C. I’ve tried to send a ray to the center of the object and get the hit position.
The problem is :
- the center of the object is not always in the center of the mesh (see image)
- there is no way to touch the object if another one (with same properties or not) is between.
The ray would be stopped and return unexpected results.
D. This is the closest point. This is the position that I want to get, and I don’t know how.
If you have other methods, I would be happy to read about it