Thursday, May 5, 2011

Success at Last and the Age of Industry Again

The day before yesterday, I finally succeeded in fixing up my bounding sphere display issues! In my previous post, I had written about the problems that I was having with the spheres either not displaying around non-cube objects or altering the cube objects that they surrounded. They were tied together somehow but I did not know how at that point. 


Then, on Tuesday, I re-wrote a lot of my Form.cpp and BoundingSphere.cpp code, making Bounding Spheres more like forms in terms of their own matrices and transformation update functions. By adding in a transformation function, I was able to call it on the bounding spheres outside of the inner object's transformation update and consecutively instead. This really helped the situation because it prevented the order of operations (programmatic) mishap from happening. I speak more about the fix in the videos that I made to showcase the working collision spheres. 


The first video shows the improved cube collisions as they should be, and the second video demonstrates that the fix works thoroughly on other models as well (I used cylinders in this case). 








Now, it is time to move on to the collision hierarchy. I've been reading the orange collision book "Real Time Collision Detection", namely Chapter 6 which focuses on hierarchies and how to design them, select the best one, and so forth. I am going to adapt my own version in a concoction of the book's suggestions. Keenan recommended that I place small bounding spheres in the form of the underlying object model manually. This creates the collision model. I have already created this, and today will be working on converting it and using it in my Engine. 


Here is my plan for today and extending into the next two days (the goal is to get this done before the weekend):


Where the tree is represented as:

First code dealing with Elongated Rectangular Objects Surrounded by Bounding Spheres:
Hierarchy:
1. Test collision between parent Spheres Sa and Sb
     If CollisionSaSb = True
          2. Test Collision between A and B (Bounding Boxes inside)
               If CollisionAB = True
                    *Colliding Objects A and B*


Next code dealing with Tripod Objects with Sphere Based Collision Objects Surrounded by Bounding Spheres:

Hierarchy:
1. Test collision between parent Spheres Sa and Sb
     If CollisionSaSb = True
          2. Test Collision between Sa1 and Sb1...Sbn through San and Sb1...Sbn
               If Colliding = True for any San or Sbn
                    *Colliding Objects*



Although the book does not recommend manual placement of bounding objects for large scale models as this is inefficient and can lead to issues for groupings in creating a hierarchy, I can do this comfortably for my small spheres in the collision model since I already know that all of my objects will be using the same model for this project. This fact also helps in designing my tree traversal strategy. Here is a diagram I made to lay it all out, furthering the explanation of the above code idea. I haven't started implementing this yet-- that is what today's agenda is-- so I don't know how well it will work, but these are my thoughts and understanding so far.

No comments:

Post a Comment