Game Development Community

Loading collision details from a model....

by Josh Albrecht · in Torque Game Engine · 02/12/2002 (4:07 pm) · 0 replies

I am TRYING to load collision details (boxes in this case) from a model. I am basing it off the code in shapeBase.cc, around line 203, where they load the "Collision-(number)" details. I created a model with my own detail, differently named, and attempted to use the function, computeBounds to get the dimensions of the box. However, the box that it creates turns out horribly warped. :(

Some other odd things:
I wove my way into the shape code, and apparently the mesh (box) has:
32 vertices
14 sides (its a 6 sided box mind you... :)

Some questions:
1. How is a normal "Collision-1" box/detail set up in the hierarchy?
2. Can/should it be bound to a node? A node other than the root one?
3. What does computeBounds do with matrices? Why is that code there?
4. A general question. While I was debugging, I wanted to look at the actual dimensions of the vertices. I had some code to do that:
S32 objnum = shape->details[MYcollisionDetails[i]].objectDetailNum;
	 
S32 meshnum = shape->objects[objnum].startMeshIndex;

for(S32 i = 0; i<=32; i++)
{
Point3F point = shape->meshes[meshnum]->verts[i];
}

however, meshes[meshnum] does not exist... :( How do I find the real beginning of the mesh array? And should I start on something other than 0 for the verts? I didnt see anything else... :(

Any help would be GREATLY appreciated. I have been banging my head against this for a week now I think... :(