Hi

There has been a positive response so I'm gonna have a good go at it.

I just hope I don't disappoint. I'm sure you understand that its going to start simple and get more interesting as I add more features. Collision is something best left till last I think seeing as I have no idea to do it. Well to be truthful, just saying that has just got me thinking...

Here is an algorithm that I've just thought up for collisions that MAY even be possible to implement in Python:

-Find the location of the node (point on the string)

-Scan the interacting mesh for location of ALL the vertices (oh help me)

- Use pythagoras to determine the 3 nearest vertices (A, B and C) to a node at any particular time.

-Vector subtract vertex A from C then B from C then use the cross product to get the normal.

-Pythagoras again to get a unit normal vector.

-Use this normal to find the plane equation of the nearest face.

-Test to see if the node is on the plane. This may be a problem as the point is likely to be either above the plane or below the plane and never actually ON it.

-Use this information to affect the node movement probably by reversing the velocity component of the node parallel to the normal multiplied by some constant (elasticity of the collision).

Now I'm really jumping ahead . I've just had an idea for testing when the point hits the plane!

-A line-plane intersection would be better.

-The line can be formed with its direction vector being the particles velocity and a point on it being the location of that node at that point in time.

-A point on the plane where the line intersects it is found.

-Its distance from the actual node is found (pythagoras) and when it is within a certain bound it registers as a hit.

Now you can tell me all the things that are inefficient and unneccessary with this idea. It is all quite doable but here is what could do with improving:

- Do you have to got through ALL the meshes vertices and do Pythagoras on them for EVERY one of the strings nodes to find the nearest faces?

- The line-plane intersection idea is an Euler integration like method: If there is a lot of acceleration, it may lead to imperfect results.

All this is mathematically sound (I think). The question is whether it work fast enough to be useful.

At the start of this post I never thought I would ever understand how collision detection worked never mind coming up with my own scheme in 5 minutes! I must admit I'm rather pleased!

Anyway. Enough. I don't even have a simple string working yet! But I'm working on it!

Koba

P.S> Thanks eeshlo for the advice. I think that for now I'll stick with the tutorial I've got. I'll have a look into it later but if it is designed to be fast, the method you are suggesting may be more suited to the game engine than what I have in mind.