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

Method breakShape

Engine/source/ts/tsPartInstance.cpp:99–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97//-------------------------------------------------------------------------------------
98
99void TSPartInstance::breakShape(TSShapeInstance * shape, S32 subShape, Vector<TSPartInstance*> & partList, F32 * probShatter, F32 * probBreak, S32 probDepth)
100{
101 AssertFatal(subShape>=0 && subShape<shape->mShape->subShapeFirstNode.size(),"TSPartInstance::breakShape: subShape out of range.");
102
103 S32 start = shape->mShape->subShapeFirstNode[subShape];
104
105 TSPartInstance::breakShape(shape, NULL, start, partList, probShatter, probBreak, probDepth);
106
107 // update bounds (and get rid of empty parts)
108 for (S32 i=0; i<partList.size(); i++)
109 {
110 if (partList[i]->mMeshObjects.size())
111 {
112 partList[i]->updateBounds();
113 // Remove any parts parts with invalid box
114 Box3F box = partList[i]->getBounds();
115 if (!box.isValidBox())
116 {
117 Con::warnf("TSPartInstance::breakShape - part created with invalid object box. Removing from list.");
118 partList.erase(i);
119 i--;
120 }
121 }
122 else
123 {
124 partList.erase(i);
125 i--;
126 }
127 }
128}
129
130void TSPartInstance::breakShape(TSShapeInstance * shape, TSPartInstance * currentPart, S32 currentNode, Vector<TSPartInstance*> & partList, F32 * probShatter, F32 * probBreak, S32 probDepth)
131{

Callers

nothing calls this directly

Calls 11

randFMethod · 0.80
incrementMethod · 0.80
warnfFunction · 0.50
sizeMethod · 0.45
updateBoundsMethod · 0.45
getBoundsMethod · 0.45
isValidBoxMethod · 0.45
eraseMethod · 0.45
lastMethod · 0.45
push_backMethod · 0.45
addObjectMethod · 0.45

Tested by

no test coverage detected