MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / sweepAdvanceToToi

Method sweepAdvanceToToi

physx/source/lowlevel/software/src/PxsCCD.cpp:538–809  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

536}
537
538bool PxsCCDPair::sweepAdvanceToToi(PxReal dt, bool clipTrajectoryToToi)
539{
540 PxsCCDShape* ccds0 = mCCDShape0;
541 PxsRigidBody* atom0 = mBa0;
542 PxsCCDShape* ccds1 = mCCDShape1;
543 PxsRigidBody* atom1 = mBa1;
544
545 const PxsCCDPair* thisPair = this;
546
547 //Both already had a pass so don't do anything
548 if ((atom0 == NULL || atom0->mCCD->mPassDone) && (atom1 == NULL || atom1->mCCD->mPassDone))
549 return false;
550
551 //Test to validate that they're both infinite mass objects. If so, there can be no response so terminate on a notification-only
552 if((atom0 == NULL || atom0->mCore->inverseMass == 0.f) && (atom1 == NULL || atom1->mCore->inverseMass == 0.f))
553 return false;
554
555 //If the TOI < 1.f. If not, this hit happens after this frame or at the very end of the frame. Either way, next frame can handle it
556 if (thisPair->mMinToi < 1.0f)
557 {
558 if(thisPair->mCm->getWorkUnit().flags & PxcNpWorkUnitFlag::eDISABLE_RESPONSE || thisPair->mMaxImpulse == 0.f)
559 {
560 //Don't mark pass as done on either body
561 return true;
562 }
563
564
565 PxReal minToi = thisPair->mMinToi;
566
567 PxF32 penetration = -mPenetration * 10.f;
568
569 PxVec3 minToiNormal = thisPair->mMinToiNormal;
570
571 if (!minToiNormal.isNormalized())
572 {
573 // somehow we got zero normal. This can happen for instance if two identical objects spawn exactly on top of one another
574 // abort ccd and clip to current toi
575 if (atom0 && !atom0->mCCD->mPassDone)
576 {
577 atom0->advancePrevPoseToToi(minToi);
578 atom0->advanceToToi(minToi, dt, true);
579 atom0->mCCD->mUpdateCount++;
580 }
581 return true;
582 }
583
584
585
586 //Get the material indices...
587 const PxReal restitution = mRestitution;
588 const PxReal sFriction = mStaticFriction;
589 const PxReal dFriction = mDynamicFriction;
590
591
592 PxVec3 v0(0.f), v1(0.f);
593
594 PxReal invMass0(0.f), invMass1(0.f);
595#if CCD_ANGULAR_IMPULSE

Callers 1

runInternalMethod · 0.80

Calls 15

transformInertiaTensorFunction · 0.85
PxMaxFunction · 0.85
PxAbsFunction · 0.85
verifyCCDPairFunction · 0.85
printCCDDebugFunction · 0.85
advancePrevPoseToToiMethod · 0.80
advanceToToiMethod · 0.80
PxVec3Class · 0.50
PxMat33Class · 0.50
isNormalizedMethod · 0.45

Tested by

no test coverage detected