I have some object which is located on the surface of free shape. Which is the best way to get the distance between A and B points? Let’s take A1-B1 as world X axis and A2-B2 as world Z axis.
I want to know how much (by N meters) I can move the object by X axis (for example) until it reaches the edge of the surface.
See the picture below:
I guess I need to compare object’s and surface’s bounds somehow, but I have no idea how to get the farthest point from the center of each in the specific direction.
Another idea is to do raycasting from the object towards the surface edge, but it’s flat, so there is no “wall” to get the hit.
Thank you in advance for the help!