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

Method activate_physic_shell

ogsr_engine/xrGame/Missile.cpp:695–747  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

693}
694
695void CMissile::activate_physic_shell()
696{
697 if (!smart_cast<CMissile*>(H_Parent()))
698 {
699 inherited::activate_physic_shell();
700 return;
701 }
702
703 Fvector l_vel;
704 l_vel.set(m_throw_direction);
705 l_vel.normalize_safe();
706 l_vel.mul(m_fThrowForce);
707
708 Fvector a_vel;
709 CInventoryOwner* inventory_owner = smart_cast<CInventoryOwner*>(H_Root());
710 if (inventory_owner && inventory_owner->use_throw_randomness())
711 {
712 float fi, teta, r;
713 fi = ::Random.randF(0.f, 2.f * M_PI);
714 teta = ::Random.randF(0.f, M_PI);
715 r = ::Random.randF(2.f * M_PI, 3.f * M_PI);
716 float rxy = r * _sin(teta);
717 a_vel.set(rxy * _cos(fi), rxy * _sin(fi), r * _cos(teta));
718 }
719 else
720 a_vel.set(0.f, 0.f, 0.f);
721
722 XFORM().set(m_throw_matrix);
723
724 CEntityAlive* entity_alive = smart_cast<CEntityAlive*>(H_Root());
725 if (entity_alive && entity_alive->character_physics_support())
726 {
727 Fvector parent_vel;
728 entity_alive->character_physics_support()->movement()->GetCharacterVelocity(parent_vel);
729 l_vel.add(parent_vel);
730 }
731
732 VERIFY(!m_pPhysicsShell);
733 create_physic_shell();
734 m_pPhysicsShell->Activate(m_throw_matrix, l_vel, a_vel);
735 // m_pPhysicsShell->AddTracedGeom ();
736 m_pPhysicsShell->SetAllGeomTraced();
737 m_pPhysicsShell->add_ObjectContactCallback(ExitContactCallback);
738 m_pPhysicsShell->set_CallbackData(smart_cast<CPhysicsShellHolder*>(entity_alive));
739 // m_pPhysicsShell->remove_ObjectContactCallback (ExitContactCallback);
740 m_pPhysicsShell->SetAirResistance(0.f, 0.f);
741 m_pPhysicsShell->set_DynamicScales(1.f, 1.f);
742
743 IKinematics* kinematics = smart_cast<IKinematics*>(Visual());
744 VERIFY(kinematics);
745 kinematics->CalculateBones_Invalidate();
746 kinematics->CalculateBones();
747}
748void CMissile::net_Relcase(CObject* O)
749{
750 inherited::net_Relcase(O);

Callers

nothing calls this directly

Calls 15

H_ParentFunction · 0.85
H_RootFunction · 0.85
_sinFunction · 0.85
_cosFunction · 0.85
XFORMFunction · 0.85
VisualFunction · 0.85
randFMethod · 0.80
GetCharacterVelocityMethod · 0.80
movementMethod · 0.80
SetAllGeomTracedMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected