Objects repelling each other

Hi all, noob here.
I’m taking a summer course in blender and my question is how to make to objects repel each other when they get within a certain distance of each other, or rather one object replling from the other and return to original position when the “repellor” moves away?

Welcome to the forum.

What kind of objects and what are you trying to simulate? Blender has soft-bodies, rigid bodies, and Particles, all of which can be repelled. If we know what you are trying to simulate, we might be able to help you focus on the best tool to use.

Thanks for the quick reply.
I thought there were a general way to have two “helpers” repel each other and then bind these to various objects.
Lets take two hard bodies as an example then. One cube approaches another by way of me moving it with my mouse in the viewport. I then want the approached cube to be repelled when my mouse controlled cube is within a certain distance, like repelling magnets, and to return to its original position when I move my cube away. Also neat if this would work from any approach angle.

If you’ve got an answer to this, can you please share it with me, I just can’t figure out a way to do this in blender

Parent empties with force field physics to your rigid bodies:rbforces.blend (124.9 KB)

For your exact example, parent a force field to your mouse-controlled cube. In order to cause it to move back to its original position, you’ll probably want to use a rigid body constraint, probably spring type, to move it back.