Monday, May 10, 2010

I recently got the chance to help another of the final project teams with their collisions.
After focusing on the collisions for our game for so many weeks, my mind now thinks in rays, triangles and spheres.
The two things I found that they were missing was, in their sphere swept test, they were going through some geometry, since the "nearby triangles" they were getting was based on the first position of the player and the last, no middle positions. I told them that building a big sphere around the start and end spheres, and get the triangles based on that one would fix their issue.
Personally, I would have done moving sphere to triangle collisions (like in our game), but hey, whatever works for them! At least they got it working now and that's good.
The other problem they were having was that they were basing themselves on a point to get the nearby triangles on their BVH (Bounding Volume Hierarchy) while their player actually has its own AABB and a couple of spheres. I would've done AABB to AABB collision since those are super fast and easy, but their sphere swept test required something different. I told them they should have, instead of a "point in AABB" check, to do a "sphere in AABB" check (which was basically just expanding the faces of the AABB by the radius of the sphere).
Of course, I still prefer moving sphere checks since they wouldn't give us as many false positives as having to check a huge sphere covering the whole player trajectory to get triangles and then check against them.
That's one of the things I would suggest they change if they have some extra time. But right now, I'm happy that their project is working!

No comments:

Post a Comment