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

Method CreateBody

ogsr_engine/xrGame/PhysicObject.cpp:203–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201}
202
203void CPhysicObject::CreateBody(CSE_ALifeObjectPhysic* po)
204{
205 if (m_pPhysicsShell)
206 return;
207 IKinematics* pKinematics = smart_cast<IKinematics*>(Visual());
208 switch (m_type)
209 {
210 case epotBox: {
211 m_pPhysicsShell = P_build_SimpleShell(this, m_mass, !po->_flags.test(CSE_ALifeObjectPhysic::flActive));
212 {
213 // для SimpleShell нет привязки к костям и вообще не работают параметры из секцции collide
214 // но объекты с таким type есть в all.spawn например визуалы сталкеров на Арене. я так и не нашел как оно раньше могло работать
215 // пока сделаем фикс прямо тут
216
217 if (*po->fixed_bones)
218 {
219 m_pPhysicsShell->get_ElementByStoreOrder(0)->Fix();
220
221 CInifile& ini = po->spawn_ini();
222
223 if (ini.line_exist("collide", "ignore_static"))
224 {
225 m_pPhysicsShell->SetIgnoreStatic();
226 }
227
228 if (ini.line_exist("collide", "ignore_dynamic"))
229 {
230 m_pPhysicsShell->SetIgnoreDynamic();
231 }
232 }
233 }
234 }
235 break;
236 case epotFixedChain:
237 case epotFreeChain: {
238 m_pPhysicsShell = P_create_Shell();
239 m_pPhysicsShell->set_Kinematics(pKinematics);
240 AddElement(0, pKinematics->LL_GetBoneRoot()); //-V595
241 m_pPhysicsShell->setMass1(m_mass);
242 }
243 break;
244
245 case epotSkeleton: {
246 // pKinematics->LL_SetBoneRoot(0);
247 CreateSkeleton(po);
248 }
249 break;
250
251 default: {
252 }
253 break;
254 }
255
256 m_pPhysicsShell->mXFORM.set(XFORM());
257 m_pPhysicsShell->SetAirResistance(0.001f, 0.02f);
258 if (pKinematics)
259 {
260 SAllDDOParams disable_params;

Callers

nothing calls this directly

Calls 15

VisualFunction · 0.85
P_build_SimpleShellFunction · 0.85
P_create_ShellFunction · 0.85
XFORMFunction · 0.85
FixMethod · 0.80
spawn_iniMethod · 0.80
line_existMethod · 0.80
SetIgnoreStaticMethod · 0.80
SetIgnoreDynamicMethod · 0.80
LL_GetBoneRootMethod · 0.80
setMass1Method · 0.80

Tested by

no test coverage detected