MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / updateStateList

Method updateStateList

Engine/source/collision/convex.cpp:508–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

506// ---------------------------------------------------------------------------
507
508void Convex::updateStateList(const MatrixF& mat, const Point3F& scale, const Point3F* displacement)
509{
510 PROFILE_SCOPE( Convex_UpdateStateList );
511
512 Box3F box1 = getBoundingBox(mat, scale);
513 box1.minExtents -= Point3F(1, 1, 1);
514 box1.maxExtents += Point3F(1, 1, 1);
515 if (displacement) {
516 Point3F oldMin = box1.minExtents;
517 Point3F oldMax = box1.maxExtents;
518
519 box1.minExtents.setMin(oldMin + *displacement);
520 box1.minExtents.setMin(oldMax + *displacement);
521 box1.maxExtents.setMax(oldMin + *displacement);
522 box1.maxExtents.setMax(oldMax + *displacement);
523 }
524 sTag++;
525
526 // Destroy states which are no longer intersecting
527 for (CollisionStateList* itr = mList.mNext; itr != &mList; itr = itr->mNext) {
528 Convex* cv = (itr->mState->mA == this)? itr->mState->mB: itr->mState->mA;
529 cv->mTag = sTag;
530 if (!box1.isOverlapped(cv->getBoundingBox())) {
531 CollisionState* cs = itr->mState;
532 itr = itr->mPrev;
533 delete cs;
534 }
535 }
536
537 // Add collision states for new overlapping objects
538 for (CollisionWorkingList* itr0 = mWorking.wLink.mNext; itr0 != &mWorking; itr0 = itr0->wLink.mNext) {
539 Convex* cv = itr0->mConvex;
540 if (cv->mTag != sTag && box1.isOverlapped(cv->getBoundingBox())) {
541 CollisionState* state = new GjkCollisionState;
542 state->set(this,cv,mat,cv->getTransform());
543 state->mLista->linkAfter(&mList);
544 state->mListb->linkAfter(&cv->mList);
545 }
546 }
547}
548
549
550//----------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 8

isOverlappedMethod · 0.60
Point3FClass · 0.50
setMinMethod · 0.45
setMaxMethod · 0.45
getBoundingBoxMethod · 0.45
setMethod · 0.45
getTransformMethod · 0.45
linkAfterMethod · 0.45

Tested by

no test coverage detected