Hello Folks,

I am currently implementing a physics engine for a game project, modelling after XenoCollide by Gary Snethen. (Games Programming Gems 7)

I have a simple question with regards to support mapping function for triangles in 3D space.

Currently, this is what I have:

- Suppose the Triangle stores an array of 3 vertices.

**Code:**

void Triangle::GetSupportPoint(Vector3& point, const Vector3& normal)

{

f32 maxDist = FLT_MIN;

s32 maxIndex = -1;

for (s32 i = 0; i < 3; ++i)

{

f32 result = vertices_[i].Dot(normal);

if (result > maxDist)

{

maxIndex = i;

maxDist = result;

}

}

return vertices_[maxIndex];

}

I have tested this against a working box collider. (working on box-box etc.)

If I lay the triangle on the XZ plane, and have my camera looking down -Y at the triangle, it seems okay.

But in actual fact, if I were to look at it on the XY plane, there seem to be a "tetrahedron effect" on the triangle. It registers a false positive on the +Y side of the plane that slopes upwards until it converges above the centroid. Also, the contact normal were going +Y but sloped towards the outer vertex for some reason.

I believe my derivation is wrong.

I seek you professional people's advice if there's any way that I can do to "flatten" the collision area.

Thanks!

Jason