Repel/avoid movement?

How can I make it so that when object A comes into a certain distance of object B, object B moves to avoid it automatically? How can I make it so that an object sends out a force that pushes another rigidbody away?

Thank you.

Exactly like that. :smiley:

I suppose that your question is in what direction the object B should be pushed?

In that case:

Vector3 direction = (B.transform.position - A.transform.position).normalized;

It’s a vector that starts at A’s position, points to B and has a length (magnitude) of 1.
You can then apply some force to B’s rigidbody:

B.rigidbody.AddForce(direction * forceAmount);