Manage the collision


I am writing a script whose goal is to simply animate some objects: as I am newbie, I modeled cylinders that move themselves in a square place.

So, to animate these obects I created some paths, and when I create an object I link it a path randomly (in a list of predefined paths).

This works very well, but sometimes objects cross themselves and there is a ‘collision’.

That’s why I would like if it is possible, thanks to a python script, to give to the objects something like a protecting field around them, in order to modify their trajectory when another object come in this field.

I don’t know if it’s possible… thanks for your help !!!

There is spherical collision detection built right into the dynamic system. Unless all your objects are spheres, you may encounter less than pixel perfect collision using that technique.

What I discovered and recently leveraged was the pointInside function available for mesh based objects. Basically, you can pass a mesh to an object and it will tell you if a point from one mesh is inside another. Then your code can make a decision about what to do in a collision state.

You can see the code in action in the Mograph Shader Effector simulator at this link.