1, vector3.magnitude length
Returns the length of the vector (read-only).
The length of the vector is
If you need to compare the lengths of some vectors, you can compare the squares of their lengths, using Sqrmagnitude (the squared calculation is fast).
So: When comparing the length of vectors, use the following sqrmagnitude method Best!
It is also best to use sqrmagnitude when detecting the position of a person in the update from the target location!
Similar to this: if ((perpos-targetposition). Sqrmagnitude < 1.0f) {}
2, vector3.sqrmagnitude length square
Returns the square of the length of this vector (read-only).
The length of the vector is calculated by using the Pythagorean theorem, the computation of two times and open root of the computer is more time consuming than adding and subtracting. So if you want to compare the lengths of two vectors, you can get a lot faster with sqrmagnitude.
Common class usage explanations