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

Method ApplyExplosion

ogsr_engine/xrGame/BreakableObject.cpp:303–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303void CBreakableObject::ApplyExplosion(const Fvector& dir, float impulse)
304{
305 if (!m_pPhysicsShell)
306 return;
307 Fvector pos;
308 pos.set(0.f, 0.f, 0.f);
309 u16 el_num = m_pPhysicsShell->get_ElementsNumber();
310 for (u16 i = 0; i < el_num; i++)
311 {
312 Fvector max_area_dir;
313 CPhysicsElement* element = m_pPhysicsShell->get_ElementByStoreOrder(i);
314 element->get_MaxAreaDir(max_area_dir);
315 float sign = max_area_dir.dotproduct(dir) > 0.f ? 1.f : -1.f;
316 max_area_dir.mul(sign);
317 element->applyImpulseTrace(pos, max_area_dir, impulse / el_num, 0);
318 }
319}
320
321void CBreakableObject::Init()
322{

Callers

nothing calls this directly

Calls 7

get_ElementsNumberMethod · 0.80
setMethod · 0.45
get_MaxAreaDirMethod · 0.45
dotproductMethod · 0.45
mulMethod · 0.45
applyImpulseTraceMethod · 0.45

Tested by

no test coverage detected