I’m trying to determine the distance between two objects with different dimensions on a specific axis.
Could anyone guide me on how to achieve this or provide any formulas or methods that might help?
I tried 2 methods,
i. I created a ray from the center of one object and check the intersection, which works good, but if the objects are not in the same axis position on Y as example then will return undefined, because the ray from center hit nothing, expected
ii. I calculated the boundingbox and got the corners, and then I tried to calculate the distance from each corner to the object, … which for some reasons not work too good.
Thank you in advance!