MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / Break

Method Break

ogsr_engine/xrGame/BreakableObject.cpp:196–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194}
195
196void CBreakableObject::Break()
197{
198 if (m_pPhysicsShell)
199 return;
200 DestroyUnbroken();
201 CreateBroken();
202 ActivateBroken();
203 u16 el_num = m_pPhysicsShell->get_ElementsNumber();
204 for (u16 i = 0; i < el_num; i++)
205 {
206 Fvector pos, dir;
207 pos.set(Random.randF(-0.3f, 0.3f), Random.randF(-0.3f, 0.3f), Random.randF(-0.3f, 0.3f));
208 dir.set(Random.randF(-0.3f, 0.3f), Random.randF(-0.3f, 0.3f), Random.randF(-0.3f, 0.3f));
209 dir.normalize();
210 m_pPhysicsShell->get_ElementByStoreOrder(i)->applyImpulseTrace(pos, dir, Random.randF(0.5f, 3.f), 0);
211 }
212 m_break_time = Device.dwTimeGlobal;
213 SheduleRegister();
214}
215
216void CBreakableObject::SendDestroy()
217{

Callers

nothing calls this directly

Calls 6

get_ElementsNumberMethod · 0.80
randFMethod · 0.80
setMethod · 0.45
normalizeMethod · 0.45
applyImpulseTraceMethod · 0.45

Tested by

no test coverage detected