Original Post
Hello I need to know what is the fastest algorithm or technique to check basic collision using my collision function. I have a function that return true or false if the two objects are colliding. BOOL bSphereTest(int obj1, int obj2 ) I currently using : I go through every single particle and check it against other ones. The penalty I think is f(n^2) which mean it becomes really slow as the number of particles increase. is there any faster way? Or how can I optimise this to get the best out of it ? I did study binary tree in University but if I can do it faster then I should look back into my books and do it again, I don’t even know which one is the fastest way. Thanks [Edited by - bargasteh on April 5, 2005 7:13:33 AM]
for (int y2 = 3; y2 <= number_of_particle; y2++) //check for collision
for(int x2 = 3; x2 <= number_of_particle; x2++)
{
if (y2 != x2){
//here I do the collision response
}
}