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

Method create_physic_shell

ogsr_engine/xrGame/CustomRocket.cpp:137–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135}
136
137void CCustomRocket::create_physic_shell()
138{
139 VERIFY(!m_pPhysicsShell);
140 Fobb obb;
141 Visual()->getVisData().box.get_CD(obb.m_translate, obb.m_halfsize);
142 obb.m_rotate.identity();
143
144 // Physics (Elements)
145 CPhysicsElement* E = P_create_Element();
146 R_ASSERT(E);
147
148 Fvector ax;
149 float radius;
150 CHOOSE_MAX(obb.m_halfsize.x, ax.set(obb.m_rotate.i); ax.mul(obb.m_halfsize.x); radius = _min(obb.m_halfsize.y, obb.m_halfsize.z); obb.m_halfsize.y /= 2.f;
151 obb.m_halfsize.z /= 2.f, obb.m_halfsize.y, ax.set(obb.m_rotate.j); ax.mul(obb.m_halfsize.y); radius = _min(obb.m_halfsize.x, obb.m_halfsize.z);
152 obb.m_halfsize.x /= 2.f; obb.m_halfsize.z /= 2.f, obb.m_halfsize.z, ax.set(obb.m_rotate.k); ax.mul(obb.m_halfsize.z);
153 radius = _min(obb.m_halfsize.y, obb.m_halfsize.x); obb.m_halfsize.y /= 2.f; obb.m_halfsize.x /= 2.f)
154 // radius*=1.4142f;
155 Fsphere sphere1, sphere2;
156 sphere1.P.add(obb.m_translate, ax);
157 sphere1.R = radius * 1.4142f;
158
159 sphere2.P.sub(obb.m_translate, ax);
160 sphere2.R = radius / 2.f;
161
162 E->add_Box(obb);
163 E->add_Sphere(sphere1);
164 E->add_Sphere(sphere2);
165
166 // Physics (Shell)
167 m_pPhysicsShell = P_create_Shell();
168 R_ASSERT(m_pPhysicsShell);
169 m_pPhysicsShell->add_Element(E);
170 m_pPhysicsShell->setMass(7.f);
171 m_pPhysicsShell->SetAirResistance();
172}
173
174//////////////////////////////////////////////////////////////////////////
175// Rocket specific functions

Callers

nothing calls this directly

Calls 15

VisualFunction · 0.85
P_create_ElementFunction · 0.85
P_create_ShellFunction · 0.85
get_CDMethod · 0.80
add_ElementMethod · 0.80
_minFunction · 0.50
identityMethod · 0.45
setMethod · 0.45
mulMethod · 0.45
addMethod · 0.45
subMethod · 0.45
add_BoxMethod · 0.45

Tested by

no test coverage detected