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

Method AddElement

ogsr_engine/xrGame/PhysicObject.cpp:166–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166void CPhysicObject::AddElement(CPhysicsElement* root_e, int id)
167{
168 IKinematics* K = smart_cast<IKinematics*>(Visual());
169
170 CPhysicsElement* E = P_create_Element();
171 CBoneInstance& B = K->LL_GetBoneInstance(u16(id));
172 E->mXFORM.set(K->LL_GetTransform(u16(id)));
173 Fobb bb = K->LL_GetBox(u16(id));
174
175 if (bb.m_halfsize.magnitude() < 0.05f)
176 {
177 bb.m_halfsize.add(0.05f);
178 }
179 E->add_Box(bb);
180 E->setMass(10.f);
181 E->set_ParentElement(root_e);
182 B.set_callback(bctPhysics, m_pPhysicsShell->GetBonesCallback(), E);
183 m_pPhysicsShell->add_Element(E);
184 if (!(m_type == epotFreeChain && root_e == 0))
185 {
186 CPhysicsJoint* J = P_create_Joint(CPhysicsJoint::full_control, root_e, E);
187 J->SetAnchorVsSecondElement(0, 0, 0);
188 J->SetAxisDirVsSecondElement(1, 0, 0, 0);
189 J->SetAxisDirVsSecondElement(0, 1, 0, 2);
190 J->SetLimits(-M_PI / 2, M_PI / 2, 0);
191 J->SetLimits(-M_PI / 2, M_PI / 2, 1);
192 J->SetLimits(-M_PI / 2, M_PI / 2, 2);
193 m_pPhysicsShell->add_Joint(J);
194 }
195
196 CBoneData& BD = K->LL_GetData(u16(id));
197 for (vecBonesIt it = BD.children.begin(); BD.children.end() != it; ++it)
198 {
199 AddElement(E, (*it)->GetSelfID());
200 }
201}
202
203void CPhysicObject::CreateBody(CSE_ALifeObjectPhysic* po)
204{

Callers

nothing calls this directly

Calls 15

VisualFunction · 0.85
P_create_ElementFunction · 0.85
P_create_JointFunction · 0.85
set_ParentElementMethod · 0.80
set_callbackMethod · 0.80
GetBonesCallbackMethod · 0.80
add_ElementMethod · 0.80
SetLimitsMethod · 0.80
add_JointMethod · 0.80
setMethod · 0.45
magnitudeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected