+ improved KinematicCharacterController
+ improved btSubsimplexConvexCast, btContinuousConvexCollision and btGjkConvexCast to support configuration that start in touching/penetration, required for 'sliding'. + added files to CMakeLists.txt for CharacterController + bump up version to 2.70 (preparation for beta)
This commit is contained in:
@@ -51,10 +51,18 @@ bool btContinuousConvexCollision::calcTimeOfImpact(
|
||||
btTransformUtil::calculateVelocity(fromA,toA,btScalar(1.),linVelA,angVelA);
|
||||
btTransformUtil::calculateVelocity(fromB,toB,btScalar(1.),linVelB,angVelB);
|
||||
|
||||
|
||||
btScalar boundingRadiusA = m_convexA->getAngularMotionDisc();
|
||||
btScalar boundingRadiusB = m_convexB->getAngularMotionDisc();
|
||||
|
||||
btScalar maxAngularProjectedVelocity = angVelA.length() * boundingRadiusA + angVelB.length() * boundingRadiusB;
|
||||
btVector3 relLinVel = (linVelB-linVelA);
|
||||
|
||||
btScalar relLinVelocLength = (linVelB-linVelA).length();
|
||||
|
||||
if ((relLinVelocLength+maxAngularProjectedVelocity) == 0.f)
|
||||
return false;
|
||||
|
||||
|
||||
btScalar radius = btScalar(0.001);
|
||||
|
||||
@@ -108,8 +116,8 @@ bool btContinuousConvexCollision::calcTimeOfImpact(
|
||||
dist = pointCollector1.m_distance;
|
||||
n = pointCollector1.m_normalOnBInWorld;
|
||||
|
||||
|
||||
|
||||
btScalar projectedLinearVelocity = relLinVel.dot(n);
|
||||
|
||||
//not close enough
|
||||
while (dist > radius)
|
||||
{
|
||||
@@ -120,7 +128,7 @@ bool btContinuousConvexCollision::calcTimeOfImpact(
|
||||
}
|
||||
btScalar dLambda = btScalar(0.);
|
||||
|
||||
btScalar projectedLinearVelocity = (linVelB-linVelA).dot(n);
|
||||
projectedLinearVelocity = relLinVel.dot(n);
|
||||
|
||||
//calculate safe moving fraction from distance / (linear+rotational velocity)
|
||||
|
||||
@@ -130,6 +138,8 @@ bool btContinuousConvexCollision::calcTimeOfImpact(
|
||||
|
||||
dLambda = dist / (projectedLinearVelocity+ maxAngularProjectedVelocity);
|
||||
|
||||
|
||||
|
||||
lambda = lambda + dLambda;
|
||||
|
||||
if (lambda > btScalar(1.))
|
||||
@@ -187,6 +197,10 @@ bool btContinuousConvexCollision::calcTimeOfImpact(
|
||||
|
||||
}
|
||||
|
||||
//don't report time of impact for motion away from the contact normal (or causes minor penetration)
|
||||
if ((projectedLinearVelocity+ maxAngularProjectedVelocity)<=result.m_allowedPenetration)//SIMD_EPSILON)
|
||||
return false;
|
||||
|
||||
result.m_fraction = lambda;
|
||||
result.m_normal = n;
|
||||
result.m_hitPoint = c;
|
||||
|
||||
Reference in New Issue
Block a user