| 301 | } |
| 302 | |
| 303 | void 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 | |
| 321 | void CBreakableObject::Init() |
| 322 | { |
nothing calls this directly
no test coverage detected