Keeping a minimum distance between animated objects

Hi community

I’m having a bit of a headache here. I have to animate several 100 spheres forming shapes in the air. They have to transition over time from one shape to the other. The problem is, in the entire animation (about 10 minutes of it), there cannot be less than 2,5 meters between the center of each sphere, at any given time. Right now, i’m doing it by hand, but maybe there will be other animations of this kind.
Do you guys know of any way to automate the process, so that Blender will automatically correct the distances over all the animation? Any trick, script, or plugin? I’m looking at Animation Nodes, but i only have a few days to do this, and never used it before, so i don’t think i can learn it before the deadline… :anguished:

Does any one know a fast way to do this, please?

Any help would be very welcome.


It is really hard to say without seing what you are trying to achieve. I think your best bet is Animation Nodes or Sverchok. You can also code a Python script that can be used as a driver to keep objects distances.

Another approach would be to write a Python script that adds the necessary drivers and constraints to all the animated objects.

There could be other solution but you need to show some screenshots.

Thanks you for the answer

Here is a video showing what i pretend to do>

I’m animating the several poses by hand, but the spheres can’t NEVER be less than, let’s suppose, 2.5 meters away from each other (they’re supposed to be drones flying). The problem arises between the poses, where i have to check and correct each sphere by hand. I’m supposed to do this to 100 spheres, for several 10 minute animations.

I thought Python or Animation Nodes should be a good option, but the problem is i don’t know how to program, and i just started to play with Animation Nodes, so right now i don’t know what to do with it, and don’t have enough time to learn it, before deadline.

Can you point in some direction with Animation Nodes, or point a tutorial, or something that could help with this?

Thank you so much

I would think that managing a limited distance for the interaction for 100 objects would be a pretty difficult problem-- it’s permutative in nature to even figure out if there’s a problem, and once there is a problem, there’s no clear algorithmic fix, as any fix one place can make another place wrong.

What I would do is use rigid body physics for this. Each object gets get a sphere type rigid body, with gravity disabled or set to 0, and a strong rigid body constraint linking the object to a non-colliding, non-rendering, animated rigid body that you control manually. Then you let collision (and only collision) push them off the non-rendering control.

‘Keyed’ particles with ‘Boids’ - but you still have to learn it.

Particles i know how to use, but it’s not working as intended, in the transitions from Boids to the next keyframed pose. I need the spheres to go as linear as possible.

The rigid body physics with constrains seems like a good option, but the spheres only get out of each others paths when they collide, resulting in a bumpy motion.

Anyway, thank you all for the ideas. I will continue to investigate the best option, given the short deadlines. Maybe i can do something with Animation Nodes. I’ll see if i can find any tutorials that can help…

KEYED not keyFramed - although you do have to, and thats where the ‘Boids’ come in, they have their own ‘intelligence’, but there are parameters.

I would consider something like Animation Nodes. Or some other way to animate arrays where you can manually keyframe a distance between objects over time.

Something like this, it is overkill to try to use dynamics or particles. For mograph it is better to use something like nodes where you can have explicit control.

Maybe something like a Matrix:

Maybe a kd tree can be used to solve the distance problem either with python or animation nodes.

I used Find Close Points in Animation Nodes to detect where is distance violation happened. But it is just a visual thing, actual motion restrictment is a way harder, like recreate rigid physics inside AN. Either you have to smartly sort drone appearance and timings, or try polishing physics.

Thanks for the suggestions.

I don’t know how to use a kd tree

Right now i’m following that path of smartly (the best i can, at least) sorting drone appearance and timings…

After finishing this, when i have the time for it, i will dig deeper into Animation Nodes

kd trees ( and bvh trees ) sound more difficult than they are. Basically it is a way to find stuff based on its distance.

This guy does a good job explaining it:


Thank you. I will watch those :+1:

1 Like

Did you find a solution?

I don’t exaclty get what you’re trying to do. but here’s what you can do if you’re in a hurry.

set up your final camera movement, only fix the collisions that are visible and disturbing in it. you can fix a lot of mess by cheating with motion blur in addition.

whoopsie, didn’t see this was old.