public float getdistance(vector3 startpoint, vector3 endpoint)
{
float distance = (startpoint - endpoint).magnitude;
return distance;
}
方法2
public double getdistance(vector3 startpoint, vector3 endpoint)
{
double x = system.math.abs(endpoint.x - startpoint.x);
double y = system.math.abs(endpoint.y - startpoint.y);
return math.sqrt(x * x + y * y);
}
发表评论