Vector3.Distance
Deklarasyon
public static float Distance(Vector3 a, Vector3 b);
Açıklama
a ve b arasındaki mesafeyi döndürür.
Vector3.Distance(a, b), (a-b).magnitude ile aynıdır.
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour
{
public Transform other;
void Example()
{
if (other)
{
float dist = Vector3.Distance(other.position, transform.position);
print("Distance to other: " + dist);
}
}
}
Bu blog Unity Docs'un Türkçeye çevrilmiş halidir.
Yorumlar
Yorum Gönder