Capsule separating axis

Please don't post Bullet support questions here, use the above forums instead.
Post Reply
jalfonsosm
Posts: 2
Joined: Fri Nov 12, 2010 8:41 am

Capsule separating axis

Post by jalfonsosm »

Hello,

Sorry for my level of English, I hope you can understand this mail :)

I have problems with test collsion between capsules and triangles using separatiion axis test.

For the directions, I use:
- The triangle normal against the two vertex of the capsule segment (the cylinder axis of the capsule)
- The triangle edges against the capsule segment

For each test, I add the capsule sphere radius to the two projected capsule vertices for find the correct distance.

void CapsuleCollisionGeometry::getIntervalMinMax(const vector3 *dirAxis, float& min, float& max) const
{
min = max = dirAxis->dotProduct(m_segmentPoints[0]);

float d = dirAxis->dotProduct(m_segmentPoints[1]);

if(d < min)
{
min = d;
}

if(d > max)
{
max = d;
}

min -= m_sphereRad;
max += m_sphereRad;
}

But some of the collsions are missed. I supose that I need additional axis to test. I read several solutions, but I don't know what is the correct:

"8 directions of lines perpendicular to capsule main axis, passing through each of the box vertices (to test vertices to capsule cylinder, actually catches the faces agains capsule cylinder as a side effect"
"Get the closer triangle vertex and use the vector from this point to the center of the capsule or the closer point of the capsule segment"
...

Somebody can help me?

Thanks in advance.

Juan Alfonso
fishboy82
Posts: 91
Joined: Wed Jun 10, 2009 4:01 am

Re: Capsule separating axis

Post by fishboy82 »

Actually in my code I find Axis as
1. triangle face normal,
2.Triangle edge-capsule edge ,
3.triangle point - capsule edge
4.trignale point - capsule edge point

3 and 4 will have totally 2+2*3 axis but they can be simplified to 3 axis test
.in my code i first find the cloest point between first triangle edge-capsule segment, use these 2 points as the first seperate axis ,then the second edge of triangle , then the third

it seems in my test this will miss no collision .
Hope this help
Post Reply