📜  c# 获取距离 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:12.750000             🧑  作者: Mango

代码示例1
//For Unity C#
float GetDistance(Vector2 posA, Vector2 posB) {
    float dx = posA.x - posB.x;
    float dy = posA.y - posB.y;
    float distance = Mathf.Sqrt(dx * dx + dy * dy);
    return distance;
}