Try this simple line of code:
public float DistanceBetweenVectors(Vector3 v1, Vector3 v2)
{
var distance = Math.pow((v1.x - v2.x), 2) + Math.pow((v1.y - v2.y), 2) + Math.pow((v1.z - v2.z), 2);
return (float)Math.sqrt(distance);
}
static void Main(string[] args)
{
Console.WriteLine("Distance between two v1 (2, 3, 2) and v2 (3, 3, 3) is: {0:F2}", DistanceBetweenVectors(new Vector3(2, 3, 2), new Vector3(3, 3, 3)));
Console.ReadLine();
}
You can also put a Vector2 in the distance formula, just create an overload for the same function and just take out the (v1.z - v2.z) and you will get your distance between two vectors.
Cheers,
Stackout