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

Method buildConvex

Engine/source/T3D/physicalZone.cpp:507–543  ·  view source on GitHub ↗

--------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

505
506//--------------------------------------------------------------------------
507void PhysicalZone::buildConvex(const Box3F& box, Convex* convex)
508{
509 // These should really come out of a pool
510 mConvexList->collectGarbage();
511
512 Box3F realBox = box;
513 mWorldToObj.mul(realBox);
514 realBox.minExtents.convolveInverse(mObjScale);
515 realBox.maxExtents.convolveInverse(mObjScale);
516
517 if (realBox.isOverlapped(getObjBox()) == false)
518 return;
519
520 // Just return a box convex for the entire shape...
521 Convex* cc = 0;
522 CollisionWorkingList& wl = convex->getWorkingList();
523 for (CollisionWorkingList* itr = wl.wLink.mNext; itr != &wl; itr = itr->wLink.mNext) {
524 if (itr->mConvex->getType() == BoxConvexType &&
525 itr->mConvex->getObject() == this) {
526 cc = itr->mConvex;
527 break;
528 }
529 }
530 if (cc)
531 return;
532
533 // Create a new convex.
534 BoxConvex* cp = new BoxConvex;
535 mConvexList->registerObject(cp);
536 convex->addToWorkingList(cp);
537 cp->init(this);
538
539 mObjBox.getCenter(&cp->mCenter);
540 cp->mSize.x = mObjBox.len_x() / 2.0f;
541 cp->mSize.y = mObjBox.len_y() / 2.0f;
542 cp->mSize.z = mObjBox.len_z() / 2.0f;
543}
544
545bool PhysicalZone::testObject(SceneObject* enter)
546{

Callers

nothing calls this directly

Calls 13

collectGarbageMethod · 0.80
addToWorkingListMethod · 0.80
isOverlappedMethod · 0.60
mulMethod · 0.45
convolveInverseMethod · 0.45
getTypeMethod · 0.45
getObjectMethod · 0.45
registerObjectMethod · 0.45
initMethod · 0.45
getCenterMethod · 0.45
len_xMethod · 0.45
len_yMethod · 0.45

Tested by

no test coverage detected