# Sphere/Polygonal Collsion?

I was thinking up a fur animation system, and though about Building a mesh then adding a massive series of sphere within the surface areas of each face, then using a joint or pen system do collsion base on that to calcuate the rotation each the fur (wich would use the card meathod). Or just build the spheres by hand. But then then is the issue od defomating meshes.

So I was wondering if anyone here know about polygonal collsion. I know is very expensive on cpu, but maybe it will spark intrest in a blender developer to impliment if I get it working.

I’m interested in this as well. As i’m also looking in fluid dynamic (though it’s not as simple). What you ask may be done with the bloded dll. (search in this forum) It’s a dll you can link to in python script. to use the ODE solver. This is is easiest way to get good result.
You can also code a simple one based on simple physic law; vector, speed, direction, friction, gravitation. Imho, the most difficult is the collision detection. Though i’m sure you can go in each mesh and see if one face touch this other face and loop in the posibilities. Now this is cpu expensive. Though if you only relie your physic system on spherical collision, it’s a lot more simple.
Now, doing it in python, you’r on for a baked result in ipo for sure.

Here is a very simple collision detection algo I use to spawn cubic objects all around the scene. It take about .01 sec to detect if one object is in collision in a scene of 1000 object.

``````
def locisfree(x,y,z,dia):
curobj = [x,y,z]
for ast in G["ast"]:
check = 0
obj = Object.Get(ast["obj"])
loc = obj.getLocation()
limit = (G["library"][ast["lib_id"]]["diameter"]/2)+(dia/2)
for i in range(3):
if not ((curobj[i]&gt;loc[i]-limit) and (curobj[i]&lt;loc[i]+limit)):
check += 1
if not (check == 3):
debug("false:" + str(check))
return(False)
return(True)

``````

This is a copy-past from one of my script but it work like this:
1-I give the position of my object plus the diameter it take.
2-I loop in a library (G[“ast”]) where I keep all the object to calculate with some more information like the diameter of this object.
3-for each entry, I get the actual position of the obejct, the diameter and see if based on the position and the diameter, the 2 object tested is too near(collide). It will run the same test 3 time on each object, one for each axe. If 3 axes don’t touch, then I return true.

For a spherical colision you need to be able to calculate on any angle of possible collision. Logicaly there is only one possible spot of collison between two sphere. So you only need to test once. you just need to do a linear calculation based on the position of each sphere. From there just calculate the distance between the two center, then add the two diameter together and see if there are too near(colide) by doing distance-diameter. If the result is negative, then it’s too near.

Hope it give you idea for now.
Good day