- Home /
how to find the distance between two points?
so i want to make a circle on my own because i want to test myself but i want to find and set the distance between two pints on a mesh. so is there a way to do this?
i meant that i want to come up with my own solution.
Answer by Nefahl · Aug 18, 2020 at 02:04 PM
If you subtract a position vector from another position vector the resulting vectors magnitude will be the distance between the original vectors. So you'll need to get the local or world position of your two points (make sure that you will use the same for both points) and subtract one from the other. You may want to look up Linear Algebra / Vector Calculations for more informations. Also have a look in unity's vector api for magnitude properties and more: Unity-API Vector3 Addendum: The Vector3 Struct also provides a Distance-Function to calculate the distance from a to b:
Your answer
Follow this Question
Related Questions
How to resave generated meshes with Editor Scripts? 0 Answers
Distribute terrain in zones 3 Answers
Cube Voxel not working. Help please 1 Answer
How do I make multiple meshes in the same script? 1 Answer
Mesh creation by code not working? 0 Answers