Collision Detection – Default Testing
Patrick Lam | 26 March, 2009 | 17:19
Thinking back at the discussing I had with Andor, I remember discussing about adding the functionality in so that the users can turn off the triangle-triangle test, using only the bounding sphere test. Taking up on that suggestion, I had just finished adding that functionality in.
The collision detection now by default, has the triangle-triangle test turned off. To turn it on, the user just need to pass in a boolean true value.
Plus, if users want a higher performance, the bounding sphere can definitely provide that. Comparing the testing speed for collision between two spheres, the bounding sphere test takes about 20-30 ms where as the triangle triangle test takes about 200-300ms. That’s 10 times longer, and I can’t guarantee that the results will stay the same for even more complex objects. Of course, I’m not saying all collision detection are this slow with triangle-triangle tests, and I am still trying to find out if there are more ways to increase the speed of my collision detection.
Lets hope I can get another big jump in performance soon. =)
The collision detection now by default, has the triangle-triangle test turned off. To turn it on, the user just need to pass in a boolean true value.
cd = new CollisionDetection(scn);
cd.setTriangleTest(true);Thinking more about it, it does make a lot of sense to have this feature. I mean, most of the time, I think the bounding sphere collision detection test suffice. Most collision do happen between very simple objects like a wall or a ball, and I think the bounding sphere is enough to serve that purpose.Plus, if users want a higher performance, the bounding sphere can definitely provide that. Comparing the testing speed for collision between two spheres, the bounding sphere test takes about 20-30 ms where as the triangle triangle test takes about 200-300ms. That’s 10 times longer, and I can’t guarantee that the results will stay the same for even more complex objects. Of course, I’m not saying all collision detection are this slow with triangle-triangle tests, and I am still trying to find out if there are more ways to increase the speed of my collision detection.
Lets hope I can get another big jump in performance soon. =)
