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
--
View this message in context: http://old.nabble.com/Capsule-separating-axis-tp30197392p30197392.html
Sent from the ODE mailing list archive at Nabble.com.
How is this related to ODE? If anything check the
collision_trimesh_ccylinder.cpp file.
An you probably missed the point of the separating axis test. If you
find an axis that separates the objects, then there is no collision. You
should only assume there is no collision if you found one such axis.
More axes won't guarantee collisions, they will help you find that no
collision occurred.
--
Daniel K. O.
"The only way to succeed is to build success yourself."
You need test all the minimun required axis for a correct intersection
test. For example, if you only test against the normal of the triangle, but
don't test against the edges of the triangle, you may detect wrong collsions
when the capsule intersect the plane but is outside the triangle.
I know that for spheres and other rounded objects it's neccessary
additional planes to test because these objects have "infinity" faces. But I
don't know what are these additional test.
More axes won't guarantee collisions, but if you missed any axis test, you
can have collisions when the objects are separated.
> --
> You received this message because you are subscribed to the Google Groups
> "ode-users" group.
> To post to this group, send email to ode-...@googlegroups.com.
> To unsubscribe from this group, send email to
> ode-users+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/ode-users?hl=en.
The SAT test in general can only guarantee a negative answer; that is,
if, on a given direction, the objects are separated, then they do not
intersect.
For special cases you can enumerate all the necessary and sufficient
directions to perform the test to decide both positive and negative answers.
SAT is usually not used alone; it is often a quick way to determine that
no collision exists, so no further (and more expensive) tests need to be
performed. Used in this way there is no way to miss collisions; if the
test says the objects are separated, then no collision occurs. If it
says the objects are not separated (on a given direction) then you have
to continue testing (with more directions, or more specialized tests).
This is what ODE does.
If you are relying only on SAT, then yes, you need to test all
directions, otherwise you will produce false positives (that is, saying
that there is a collision when in fact there isn't). If you are
"missing" a collision then you messed up with the logic of the test
somewhere.
Then again, you are having a generic collision detection problem in a
code that is apparently not ODE; the best place for this question would
be the gamedev or Bullet forums for example, where there is a broader
audience of which many are actively trying to learn and implement those
details.
--
Daniel K. O.
Main axis of capsule (1)
Face normal of triangle (1)
Each edge of the triangle (3)
Main axis cross each of face normal and edges (4)
For a total of 9 axes. If any one of those axes separate the two
shapes, there is no collision. If all of them fail to separate the
shapes, then there is a collision.
Main problem with SAT is it doesn't generate a contact manifold.
You can kind-of fake it by using the axis of least penetration, though.
However, Capsule/triangle is generally implemented as projected line
in plane of triangle test, though. Check Christer Ericson's orange
book ("real-time collision detection") for more information.
Sincerely,
jw
--
Americans might object: there is no way we would sacrifice our living
standards for the benefit of people in the rest of the world.
Nevertheless, whether we get there willingly or not, we shall soon
have lower consumption rates, because our present rates are
unsustainable.