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

Method buildConvex

Engine/source/T3D/player.cpp:6074–6112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6072
6073
6074void Player::buildConvex(const Box3F& box, Convex* convex)
6075{
6076 if (mShapeInstance == NULL)
6077 return;
6078
6079 // These should really come out of a pool
6080 mConvexList->collectGarbage();
6081
6082 Box3F realBox = box;
6083 mWorldToObj.mul(realBox);
6084 realBox.minExtents.convolveInverse(mObjScale);
6085 realBox.maxExtents.convolveInverse(mObjScale);
6086
6087 if (realBox.isOverlapped(getObjBox()) == false)
6088 return;
6089
6090 Convex* cc = 0;
6091 CollisionWorkingList& wl = convex->getWorkingList();
6092 for (CollisionWorkingList* itr = wl.wLink.mNext; itr != &wl; itr = itr->wLink.mNext) {
6093 if (itr->mConvex->getType() == BoxConvexType &&
6094 itr->mConvex->getObject() == this) {
6095 cc = itr->mConvex;
6096 break;
6097 }
6098 }
6099 if (cc)
6100 return;
6101
6102 // Create a new convex.
6103 BoxConvex* cp = new OrthoBoxConvex;
6104 mConvexList->registerObject(cp);
6105 convex->addToWorkingList(cp);
6106 cp->init(this);
6107
6108 mObjBox.getCenter(&cp->mCenter);
6109 cp->mSize.x = mObjBox.len_x() / 2.0f;
6110 cp->mSize.y = mObjBox.len_y() / 2.0f;
6111 cp->mSize.z = mObjBox.len_z() / 2.0f;
6112}
6113
6114
6115//----------------------------------------------------------------------------

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