Game Development Community

new Convex Problem

by Aidan Sliney · in Torque Game Engine · 03/20/2009 (12:31 pm) · 2 replies

Hi again,
I'm once again having trouble with my custom convex.Many thanks to Scott for helping me with my last problem. http://www.garagegames.com/community/forums/viewthread/87497. I'm basically just using Matts Tutorial example on Collidable objects. I'm totally new to convexes. I've just edited the getPolylist function to handle my new object with has 98 vertices and 96 faces. The player can walk through the wall of the object ( its a big egg) and then gets stuck in the middle of it. Torque does not crash, the player is just trapped inside the egg . I've only edited the getPolyList function. Are there any other functions I should edit/create for a new convex? I also want to know which face I hit when the player collides with. I think the info is somewhere in player.cc but i've dug through it a lot to no avail. Heres my code for getPolyList


void SoftBodyConvex::getPolyList(AbstractPolyList* list)
{
// Be sure to transform the list into model space

list->setTransform(&mObject->getTransform(), mObject->getScale());
// Set the object
list->setObject(mObject);

// First add the first point and get the starting offset for these points in the list
int base = list->addPoint(pOwner->mPoints[0]);

// Now add the other 97 points
for (U32 i = 1; i < 98; i++)
{
list->addPoint(pOwner->mPoints[i]);

}

for(U32 j = 0; j < 96; j++)
{
list->begin(0, i);

list->vertex(base + pOwner->connectivity[j][0]);
list->vertex(base + pOwner->connectivity[j][2]);
list->vertex(base+ pOwner->connectivity[j][2]);
list->vertex(base+ pOwner->connectivity[j][3]);

list->plane(base + pOwner->connectivity[j][0], base + pOwner->connectivity[j][1],base + pOwner->connectivity[j][2]);
list->end();

}

}

I would appreciate any comments
Thanks

#1
03/21/2009 (7:17 pm)
Quote:...and then gets stuck in the middle of it

Well that sounds like your faces are facing the wrong way. Reverse the vertex winding order (build the faces as vert 3,2,1 instead of 1,2,3) to make the faces face "out" instead of in.
#2
03/22/2009 (7:23 am)
Hi Scott,
Thank you so much. That worked perfectly. One more question. Do you know how I can find which face of the object I've hit? Like which of the 96 faces?