The DistanceBetween
method calculates the Euclidean distance between two 3D points represented by Vector3
structures. This method is static and can be called without instantiating a Vector3
object.
The DistanceBetween
method calculates the Euclidean distance between two 3D points represented by Vector3
structures. This method is static and can be called without instantiating a Vector3
object.
To use the DistanceBetween
method, pass two Vector3
references as parameters. The method will return a float
representing the distance between the two points.
Vector3 pointA = new Vector3(1.0f, 2.0f, 3.0f); Vector3 pointB = new Vector3(4.0f, 5.0f, 6.0f); float distance = Vector3.DistanceBetween(ref pointA, ref pointB); // distance now holds the value of the distance between pointA and pointB.