Merge branch 'master' of https://github.com/erwincoumans/bullet3
This commit is contained in:
@@ -132,6 +132,7 @@ bool SphereTriangleDetector::collide(const btVector3& sphereCenter,btVector3 &po
|
|||||||
else {
|
else {
|
||||||
// Could be inside one of the contact capsules
|
// Could be inside one of the contact capsules
|
||||||
btScalar contactCapsuleRadiusSqr = radiusWithThreshold*radiusWithThreshold;
|
btScalar contactCapsuleRadiusSqr = radiusWithThreshold*radiusWithThreshold;
|
||||||
|
btScalar minDistSqr = contactCapsuleRadiusSqr;
|
||||||
btVector3 nearestOnEdge;
|
btVector3 nearestOnEdge;
|
||||||
for (int i = 0; i < m_triangle->getNumEdges(); i++) {
|
for (int i = 0; i < m_triangle->getNumEdges(); i++) {
|
||||||
|
|
||||||
@@ -141,8 +142,9 @@ bool SphereTriangleDetector::collide(const btVector3& sphereCenter,btVector3 &po
|
|||||||
m_triangle->getEdge(i, pa, pb);
|
m_triangle->getEdge(i, pa, pb);
|
||||||
|
|
||||||
btScalar distanceSqr = SegmentSqrDistance(pa, pb, sphereCenter, nearestOnEdge);
|
btScalar distanceSqr = SegmentSqrDistance(pa, pb, sphereCenter, nearestOnEdge);
|
||||||
if (distanceSqr < contactCapsuleRadiusSqr) {
|
if (distanceSqr < minDistSqr) {
|
||||||
// Yep, we're inside a capsule
|
// Yep, we're inside a capsule, and record the capsule with smallest distance
|
||||||
|
minDistSqr = distanceSqr;
|
||||||
hasContact = true;
|
hasContact = true;
|
||||||
contactPoint = nearestOnEdge;
|
contactPoint = nearestOnEdge;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user