git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@244 92aac97c-a6ce-11dd-a772-7fcde58d38e6
This commit is contained in:
parent
2eed419939
commit
4185b2bbee
|
@ -497,11 +497,11 @@ void NarrowPhaseSATAlgorithm::computeContact(const OBB* const obb1, const OBB* c
|
|||
// If it's a Vertex-Something contact
|
||||
if (nbVerticesExtremeOBB1 == 1) {
|
||||
// Create a new contact
|
||||
*contact = new Contact(obb1->getBodyPointer(), obb2->getBodyPointer(), normal, obb1ExtremePoints);
|
||||
*contact = new Contact(obb1->getBodyPointer(), obb2->getBodyPointer(), normal, penetrationDepth, obb1ExtremePoints);
|
||||
}
|
||||
else if(nbVerticesExtremeOBB2 == 1) { // If its a Vertex-Something contact
|
||||
// Create a new contact
|
||||
*contact = new Contact(obb1->getBodyPointer(), obb2->getBodyPointer(), normal, obb2ExtremePoints);
|
||||
*contact = new Contact(obb1->getBodyPointer(), obb2->getBodyPointer(), normal, penetrationDepth, obb2ExtremePoints);
|
||||
}
|
||||
else if (nbVerticesExtremeOBB1 == 2 && nbVerticesExtremeOBB2 == 2) { // If it's an edge-edge contact
|
||||
// Compute the two vectors of the segment lines
|
||||
|
@ -510,6 +510,19 @@ void NarrowPhaseSATAlgorithm::computeContact(const OBB* const obb1, const OBB* c
|
|||
|
||||
double alpha, beta;
|
||||
|
||||
// If the two edges are parallel
|
||||
if (d1.isParallelWith(d2)) {
|
||||
Vector3D contactPointA;
|
||||
Vector3D contactPointB;
|
||||
|
||||
// Compute the intersection between the two edges
|
||||
computeParallelSegmentsIntersection(obb1ExtremePoints[0], obb1ExtremePoints[1], obb2ExtremePoints[0], obb2ExtremePoints[1],
|
||||
contactPointA, contactPointB);
|
||||
|
||||
|
||||
|
||||
}
|
||||
else { // If the two edges are not parallel
|
||||
// Compute the closest two points between the two line segments
|
||||
closestPointsBetweenTwoLines(obb1ExtremePoints[0], d1, obb2ExtremePoints[0], d2, &alpha, &beta);
|
||||
Vector3D pointA = obb1ExtremePoints[0] + d1 * alpha;
|
||||
|
@ -519,9 +532,10 @@ void NarrowPhaseSATAlgorithm::computeContact(const OBB* const obb1, const OBB* c
|
|||
Vector3D contactPoint = 0.5 * (pointA + pointB);
|
||||
std::vector<Vector3D> contactSet;
|
||||
contactSet.push_back(contactPoint);
|
||||
}
|
||||
|
||||
// Create a new contact
|
||||
*contact = new Contact(obb1->getBodyPointer(), obb2->getBodyPointer(), normal, contactSet);
|
||||
*contact = new Contact(obb1->getBodyPointer(), obb2->getBodyPointer(), normal, penetrationDepth, contactSet);
|
||||
}
|
||||
else if(nbVerticesExtremeOBB1 == 2 && nbVerticesExtremeOBB2 == 4) { // If it's an edge-face contact
|
||||
// TODO : Complete this ...
|
||||
|
|
Loading…
Reference in New Issue
Block a user