- Home /
Find Most Distant Geometric Points in the Scene
Hi,
How would I be able to find the most distant geometric points in the scene? What I mean, is lets say there's a 1x1x1 cube in the scene with the center at the origin (0,0,0), then the "most distant geometric points" or the vertices which are furthest away from the origin would be (0.5,0,0), (0.5,0.5,0), (0.5,0.5,0.5), (0.5,0.5,-0.5) etc.
Sorry, I don't really know how to explain what I mean any better, but I hope someone can stumble upon this and answer my question. Any help would be much appreciated.
Answer by jt78 · Nov 16, 2013 at 01:15 PM
If I'm understanding correctly, you want to find the position of the furthest vertex from the origin? An easy (but not that efficient) way to do this would be to loop through the mesh.vertices
array and use Vector3.Distance
(or Vector3.magnitude
) to find the one that is furthest away. If you want this to find the most distant point in the whole scene then you'd need to repeat that for every mesh in the scene.
You could also make a much faster approximation using the Bounds
class
Hope that helps, more clarity in the question would be useful though
Your answer
Follow this Question
Related Questions
Find center between 4 points 3 Answers
Closest point on multiple lines? 2 Answers
Angle between 2 vectors/points on a local axis 1 Answer
RayCast Hit Point rounding itself...? 1 Answer
Why in Unity is no separate Point and Vector class ? 1 Answer