Hello. How can I check the distance between two objects and then compare it to a condition that only uses ONE axis?
Ex: (If object A is 10 units away from object B on the Y axis) {do something}
Hello. How can I check the distance between two objects and then compare it to a condition that only uses ONE axis?
Ex: (If object A is 10 units away from object B on the Y axis) {do something}
Assuming A and B are both Vector3 (transform.position for each object):
if (Mathf.Abs((A - B).y) >= 10) { /* do something */ }