279 m_ownManifold =
true;
291#ifndef BT_DISABLE_CAPSULE_CAPSULE_COLLIDER
302 capsuleB->getHalfHeight(), capsuleB->getRadius(), capsuleA->getUpAxis(), capsuleB->getUpAxis(),
305 if (dist < threshold)
324 0., capsuleB->getRadius(), capsuleA->getUpAxis(), 1,
327 if (dist < threshold)
346 capsuleB->getHalfHeight(), capsuleB->getRadius(), 1, capsuleB->getUpAxis(),
349 if (dist < threshold)
359#ifdef USE_SEPDISTANCE_UTIL2
362 m_sepDistance.updateSeparatingDistance(body0->getWorldTransform(), body1->getWorldTransform());
376#ifdef USE_SEPDISTANCE_UTIL2
392 input.m_maximumDistanceSquared *=
input.m_maximumDistanceSquared;
398#ifdef USE_SEPDISTANCE_UTIL2
411 if (min0->isPolyhedral() && min1->isPolyhedral())
421 : m_hasContact(
false)
430 m_normalOnBInWorld = normalOnBInWorld;
431 m_pointInWorld = pointInWorld;
446 : m_originalResult(
result),
447 m_marginOnA(marginOnA),
448 m_marginOnB(marginOnB),
457 m_reportedDistance = depthOrg;
458 m_reportedNormalOnWorld = normalOnBInWorld;
460 btVector3 adjustedPointB = pointInWorldOrg - normalOnBInWorld * m_marginOnB;
461 m_reportedDistance = depthOrg + (m_marginOnA + m_marginOnB);
462 if (m_reportedDistance < 0.f)
464 m_foundResult =
true;
466 m_originalResult->
addContactPoint(normalOnBInWorld, adjustedPointB, m_reportedDistance);
477 btWithoutMarginResult withoutMargin(resultOut, min0Margin, min1Margin);
481 if (polyhedronA->getConvexPolyhedron() && polyhedronB->getConvexPolyhedron())
487 bool foundSepAxis =
true;
492 *polyhedronA->getConvexPolyhedron(), *polyhedronB->getConvexPolyhedron(),
495 sepNormalWorldSpace, *resultOut);
510 sepNormalWorldSpace = withoutMargin.m_reportedNormalOnWorld;
512 minDist = withoutMargin.m_reportedDistance;
517 foundSepAxis = withoutMargin.m_foundResult && minDist < 0;
525 worldVertsB1.resize(0);
528 body1Wrap->
getWorldTransform(), minDist - threshold, threshold, worldVertsB1, worldVertsB2,
556 bool foundSepAxis =
false;
557 bool useSatSepNormal =
true;
565 polyhedronB->initializePolyhedralFeatures();
569 btVector3 uniqueEdges[3] = {tri->m_vertices1[1] - tri->m_vertices1[0],
570 tri->m_vertices1[2] - tri->m_vertices1[1],
571 tri->m_vertices1[0] - tri->m_vertices1[2]};
573 uniqueEdges[0].normalize();
574 uniqueEdges[1].normalize();
575 uniqueEdges[2].normalize();
578 polyhedron.m_vertices.push_back(tri->m_vertices1[2]);
579 polyhedron.m_vertices.push_back(tri->m_vertices1[0]);
580 polyhedron.m_vertices.push_back(tri->m_vertices1[1]);
587 btVector3 faceNormal = uniqueEdges[0].cross(uniqueEdges[1]);
588 faceNormal.normalize();
598 combinedFaceA.
m_plane[0] = faceNormal[0];
599 combinedFaceA.
m_plane[1] = faceNormal[1];
600 combinedFaceA.
m_plane[2] = faceNormal[2];
601 combinedFaceA.
m_plane[3] = -planeEq;
602 polyhedron.m_faces.push_back(combinedFaceA);
609 btVector3 faceNormal = -uniqueEdges[0].cross(uniqueEdges[1]);
610 faceNormal.normalize();
621 combinedFaceB.
m_plane[0] = faceNormal[0];
622 combinedFaceB.
m_plane[1] = faceNormal[1];
623 combinedFaceB.
m_plane[2] = faceNormal[2];
624 combinedFaceB.
m_plane[3] = -planeEq;
625 polyhedron.m_faces.push_back(combinedFaceB);
628 polyhedron.m_uniqueEdges.push_back(uniqueEdges[0]);
629 polyhedron.m_uniqueEdges.push_back(uniqueEdges[1]);
630 polyhedron.m_uniqueEdges.push_back(uniqueEdges[2]);
631 polyhedron.initialize2();
633 polyhedronB->setPolyhedralFeatures(polyhedron);
637 *polyhedronA->getConvexPolyhedron(), *polyhedronB->getConvexPolyhedron(),
640 sepNormalWorldSpace, *resultOut);
652 if (dummy.m_hasContact && dummy.m_depth < 0)
656 if (dummy.m_normalOnBInWorld.dot(sepNormalWorldSpace) < 0.99)
665 sepNormalWorldSpace.setValue(0, 0, 1);
684 worldVertsB2.resize(0);
686 body0Wrap->
getWorldTransform(), worldSpaceVertices, worldVertsB2, minDist - threshold, maxDist, *resultOut);
704 if (m_numPerturbationIterations && resultOut->
getPersistentManifold()->getNumContacts() < m_minimumPointsPerturbationThreshold)
717 bool perturbeA =
true;
720 btScalar radiusA = min0->getAngularMotionDisc();
721 btScalar radiusB = min1->getAngularMotionDisc();
722 if (radiusA < radiusB)
732 if (perturbeAngle > angleLimit)
733 perturbeAngle = angleLimit;
738 unPerturbedTransform =
input.m_transformA;
742 unPerturbedTransform =
input.m_transformB;
745 for (
i = 0;
i < m_numPerturbationIterations;
i++)
777#ifdef USE_SEPDISTANCE_UTIL2
780 m_sepDistance.initSeparatingDistance(gjkPairDetector.
getCachedSeparatingAxis(), sepDist, body0->getWorldTransform(), body1->getWorldTransform());