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

Method CreatePhysicsShell

ogsr_engine/xrGame/PHShellCreator.cpp:8–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include "../Include/xrRender/Kinematics.h"
7
8void CPHShellSimpleCreator::CreatePhysicsShell()
9{
10 CPhysicsShellHolder* owner = smart_cast<CPhysicsShellHolder*>(this);
11 VERIFY(owner);
12 if (!owner->Visual())
13 return;
14
15 IKinematics* pKinematics = smart_cast<IKinematics*>(owner->Visual());
16 VERIFY(pKinematics);
17
18 if (owner->PPhysicsShell())
19 return;
20 owner->PPhysicsShell() = P_create_Shell();
21#ifdef DEBUG
22 owner->PPhysicsShell()->dbg_obj = owner;
23#endif
24 owner->m_pPhysicsShell->build_FromKinematics(pKinematics, 0);
25
26 if (owner->m_pPhysicsShell->get_ElementsNumber() == 0)
27 {
28 Msg(" ! Error: world item visual [%s] has no elements!", pKinematics->getDebugName().c_str());
29 }
30 else if (!owner->m_pPhysicsShell->get_ElementByStoreOrder(0)->has_geoms())
31 {
32 Msg(" ! Error: world item visual [%s] has no shape!", pKinematics->getDebugName().c_str());
33 }
34
35 owner->PPhysicsShell()->set_PhysicsRefObject(owner);
36 // m_pPhysicsShell->SmoothElementsInertia(0.3f);
37 owner->PPhysicsShell()->mXFORM.set(owner->XFORM());
38 owner->PPhysicsShell()->SetAirResistance(0.001f, 0.02f);
39}

Callers

nothing calls this directly

Calls 12

P_create_ShellFunction · 0.85
MsgFunction · 0.85
VisualMethod · 0.80
build_FromKinematicsMethod · 0.80
get_ElementsNumberMethod · 0.80
getDebugNameMethod · 0.80
c_strMethod · 0.45
has_geomsMethod · 0.45
set_PhysicsRefObjectMethod · 0.45
setMethod · 0.45
SetAirResistanceMethod · 0.45

Tested by

no test coverage detected