Monday, May 16, 2011

Collision Model in Place

Tonight, I am happy to announce that my collision model for the tripod is in place and accurately transformed parallel to the model. I was having a lot of trouble getting the collision model to work and have spent quite some time on this, including a recent 14+ hour non-stop programming spree. I had created the collision model in Maya by placing spheres manually in a hierarchy around the tripod. However, I could not load the model into my graphics engine. 

When I saved the model and exported the .fbx as a single mesh, the engine would only render one sphere, a single encompassing sphere that was glitchy. After much digging, I have come to the conclusion that this is because I am using Line Loops to draw wire-frame, and with multiple objects inside of objects (spheres inside of spheres) being combined into one mesh, my converter and engine are getting confused in their interpretation because the data isn't in the expected format. When I left the meshes alone, the converter would only process one sphere in the hierarchy, since the loop inside the converter is meant to process the first layer as the mesh which is standard. In other words, my collision model was not standard, especially with my need for it to maintain separateness and transparency (via mesh). 

I ended up solving this problem today by creating a header file with all of the collision model's sphere's centers and radii, which I had recorded earlier from Maya. I then created a collision volume class (which in this case is a sphere). I gave the form (tripod) 24 collision objects and set & updated them accordingly. I also needed to figure out scaling. This was a little tricky because the tripod model and sphere model were being scaled differently from the collision model's spheres, but I found the right factors and now have my collision model displaying in my Graphics engine, just like Maya. Below are some screenshots. The tripod can be seen inside of the spheres in blue. The sphere centered around the tripod is the original bounding sphere which is generated mathematically. 

I am going to go back into Maya and place a large bounding sphere around the collision model itself tomorrow. Tomorrow is also hierarchy programming day where I will begin to write hierarchy collision code. Here is what I have in the meantime;-) 





No comments:

Post a Comment