MainGeneral DiscussionDistance Between 2 Points in 3D Land >

Distance Between 2 Points in 3D Land
 One of the questions I'm asked most is the one of "how do I get the distance between 2 points in a 3D world?" The answer is simple.

Since points in a 3D world are determined by Vector3, we are provided with a neat little function called Vector3.Distance. This method takes 2 parameters, Vector3 A & Vector3 B and returns a float value.

Syntax:
public static void Distance ( ref Vector3 value1, ref Vector3 value2, out float result )

Example:
float distance = Vector3.Distance(vector3A, vector3B);

 ProxyProdigy - January 24, 2009 06:43pm



 You must be logged in to post comments.

 Not a member?

 SIGN-UP NOW
 Registration is free and easy!
   Log In

 Already a member? Login here.

User Name: 
Password: 
 
 
Forgot: Username | Password