Interior collision
by Erik Madison · in Torque Game Engine · 07/29/2003 (9:19 am) · 8 replies
Anyone have a good understanding of how this works? I could really use a Melv May style translation. There are just too many types of polylists for me to properly follow what the code is doing.
About the author
#2
07/29/2003 (3:19 pm)
The Engine Reference addresses some of this... it should be coming out RSN :)
#3
Perhaps there is more information in the actual code, in the form of comments or something? Does any know if this is the case, or better yet, know how the convex collision works in torque?
I tried to understand it for a LONG time, but I've never seen anything like it, and I dont get it. :(
08/05/2003 (7:02 pm)
I looked through the new documentation, and I see nothing new having to do with any of the collision routines.Perhaps there is more information in the actual code, in the form of comments or something? Does any know if this is the case, or better yet, know how the convex collision works in torque?
I tried to understand it for a LONG time, but I've never seen anything like it, and I dont get it. :(
#4
You might consider looking at the documentation for OPCODE or another 3d collision library. The theory behind one isn't too hard, and there are a lot of good tutorials on the 'net. Do you have any specific problems that are giving you trouble? I don't have impetus to explain /everything/, but I'd be happy to answer specific questions...
08/05/2003 (10:50 pm)
I think your problem is a lack of theory... So unfortunately the engine reference isn't going to be much help to you. :(You might consider looking at the documentation for OPCODE or another 3d collision library. The theory behind one isn't too hard, and there are a lot of good tutorials on the 'net. Do you have any specific problems that are giving you trouble? I don't have impetus to explain /everything/, but I'd be happy to answer specific questions...
#6
It seems as though perhaps the function tests each vertex to see if it is on the inside of the convex. That would make sense, but wouldnt catch every collision. So how does the edge testing work?
If you dont want to explain, that's fine. I'll just read through the links Matt posted (thanks matt), and try to figure them out.
08/06/2003 (7:31 am)
@Ben: If you could explain what the collide function does, then I think the rest of it would fall in place for me. bool ConvexFeature::collide(ConvexFeature& cf,CollisionList* cList, F32 tol)
{
// Our vertices vs. other faces
const Point3F* vert = mVertexList.begin();
const Point3F* vend = mVertexList.end();
while (vert != vend) {
cf.testVertex(*vert,cList,false, tol);
vert++;
}
// Other vertices vs. our faces
vert = cf.mVertexList.begin();
vend = cf.mVertexList.end();
while (vert != vend) {
U32 storeCount = cList->count;
testVertex(*vert,cList,true, tol);
// Fix up last reference. material and object are copied from this rather
// than the object we're colliding against.
if (storeCount != cList->count) {
cList->collision[cList->count - 1].material = cf.material;
cList->collision[cList->count - 1].object = cf.object;
}
vert++;
}
// Edge vs. Edge
const Edge* edge = mEdgeList.begin();
const Edge* eend = mEdgeList.end();
while (edge != eend) {
cf.testEdge(this,mVertexList[edge->vertex[0]],
mVertexList[edge->vertex[1]],cList, tol);
edge++;
}
return true;
}It seems as though perhaps the function tests each vertex to see if it is on the inside of the convex. That would make sense, but wouldnt catch every collision. So how does the edge testing work?
If you dont want to explain, that's fine. I'll just read through the links Matt posted (thanks matt), and try to figure them out.
#7
Our vertices vs. other obj's faces
Other obj's faces vs. our vertices
edges vs. edges
You'd want to check in ConvexFeature::testEdge, I think. I looked over it; basically it determines the closest points on the edges and sees if those points are in the convex hull.
08/06/2003 (11:15 am)
That code does three checks...Our vertices vs. other obj's faces
Other obj's faces vs. our vertices
edges vs. edges
You'd want to check in ConvexFeature::testEdge, I think. I looked over it; basically it determines the closest points on the edges and sees if those points are in the convex hull.
#8
08/07/2003 (6:56 am)
Ah ha! That makes some sense now. Thanks! :)
Torque Owner Josh Albrecht
Does anyone understand this? :)