Update btContinuousConvexCollision.cpp
This commit is contained in:
committed by
GitHub
parent
5436336a38
commit
9d50a167b0
@@ -113,12 +113,7 @@ bool btContinuousConvexCollision::calcTimeOfImpact(
|
|||||||
if ((relLinVelocLength+maxAngularProjectedVelocity) == 0.f)
|
if ((relLinVelocLength+maxAngularProjectedVelocity) == 0.f)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
btScalar lambda = btScalar(0.);
|
btScalar lambda = btScalar(0.);
|
||||||
btVector3 v(1,0,0);
|
|
||||||
|
|
||||||
int maxIter = MAX_ITERATIONS;
|
|
||||||
|
|
||||||
btVector3 n;
|
btVector3 n;
|
||||||
n.setValue(btScalar(0.),btScalar(0.),btScalar(0.));
|
n.setValue(btScalar(0.),btScalar(0.),btScalar(0.));
|
||||||
@@ -137,8 +132,7 @@ bool btContinuousConvexCollision::calcTimeOfImpact(
|
|||||||
|
|
||||||
btPointCollector pointCollector1;
|
btPointCollector pointCollector1;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
computeClosestPoints(fromA,fromB,pointCollector1);
|
computeClosestPoints(fromA,fromB,pointCollector1);
|
||||||
|
|
||||||
hasResult = pointCollector1.m_hasResult;
|
hasResult = pointCollector1.m_hasResult;
|
||||||
@@ -172,28 +166,20 @@ bool btContinuousConvexCollision::calcTimeOfImpact(
|
|||||||
|
|
||||||
dLambda = dist / (projectedLinearVelocity+ maxAngularProjectedVelocity);
|
dLambda = dist / (projectedLinearVelocity+ maxAngularProjectedVelocity);
|
||||||
|
|
||||||
|
lambda += dLambda;
|
||||||
|
|
||||||
lambda = lambda + dLambda;
|
|
||||||
|
|
||||||
if (lambda > btScalar(1.))
|
if (lambda > btScalar(1.) || lambda < btScalar(0.))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (lambda < btScalar(0.))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
|
|
||||||
//todo: next check with relative epsilon
|
//todo: next check with relative epsilon
|
||||||
if (lambda <= lastLambda)
|
if (lambda <= lastLambda)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
//n.setValue(0,0,0);
|
//n.setValue(0,0,0);
|
||||||
break;
|
//break;
|
||||||
}
|
}
|
||||||
lastLambda = lambda;
|
lastLambda = lambda;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//interpolate to next lambda
|
//interpolate to next lambda
|
||||||
btTransform interpolatedTransA,interpolatedTransB,relativeTrans;
|
btTransform interpolatedTransA,interpolatedTransB,relativeTrans;
|
||||||
|
|
||||||
@@ -223,7 +209,7 @@ bool btContinuousConvexCollision::calcTimeOfImpact(
|
|||||||
}
|
}
|
||||||
|
|
||||||
numIter++;
|
numIter++;
|
||||||
if (numIter > maxIter)
|
if (numIter > MAX_ITERATIONS)
|
||||||
{
|
{
|
||||||
result.reportFailure(-2, numIter);
|
result.reportFailure(-2, numIter);
|
||||||
return false;
|
return false;
|
||||||
@@ -237,6 +223,5 @@ bool btContinuousConvexCollision::calcTimeOfImpact(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user