Hello. I want to make it so that when object A comes within a certain distance of object B, object B will try to get away, does anyone have an ideas (It does not have to realistic or intelligent at all, just simple movement that isnt directly at object A)? Thanks.
First, use the quadratic equation for a quick distance calc: Mathf.Sqrt((x1-x2)^2+(y1-y2)^2+(z1-z2)^2). You can ignore the zs if you have no flying units. If the "enemy is within that range, then you calculate the vector to the enemy (subtract one vector from the other), normalize it (.normalize), then move in the negative direction (-vector).