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

Method buildConvex

Engine/source/T3D/trigger.cpp:502–538  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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