get distance between two vector3 code example
Example 1: how to compare distance between 2 objects unity
float distance = Vector3.Distance (object1.transform.position, object2.transform.position);
Example 2: get angle between two vectors unity
Vector3 targetDir = target.position - transform.position;
float angle = Vector3.Angle(targetDir, transform.forward);
Example 3: unity get distance between two objects
float distance = Vector3.Distance(a.transform.position, b.transform.position);
Example 4: unity multiply xyz of two vectors
using System.Collections;public class ExampleClass : MonoBehaviour
{
void Example()
{
print(Vector3.Scale(new Vector3(1, 2, 3), new Vector3(2, 3, 4)));
}
}