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

Method InitContact

ogsr_engine/xrGame/PHActorCharacter.cpp:222–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220 }
221};
222void CPHActorCharacter::InitContact(dContact* c, bool& do_collide, u16 material_idx_1, u16 material_idx_2)
223{
224 bool b1;
225 SFindPredicate fp(c, &b1);
226 RESTRICTOR_I r = std::find_if(begin(m_restrictors), end(m_restrictors), fp);
227 bool b_restrictor = (r != end(m_restrictors));
228 SGameMtl* material_1 = GMLib.GetMaterialByIdx(material_idx_1);
229 SGameMtl* material_2 = GMLib.GetMaterialByIdx(material_idx_2);
230 if ((material_1 && material_1->Flags.test(SGameMtl::flActorObstacle)) || (material_2 && material_2->Flags.test(SGameMtl::flActorObstacle)))
231 do_collide = true;
232
233 if (b_restrictor)
234 {
235 b_side_contact = true;
236 // MulSprDmp(c->surface.soft_cfm,c->surface.soft_erp,def_spring_rate,def_dumping_rate);
237 c->surface.mu = 0.00f;
238 }
239 else
240 inherited::InitContact(c, do_collide, material_idx_1, material_idx_2);
241 if (b_restrictor && do_collide &&
242 !(b1 ? static_cast<CPHCharacter*>(retrieveGeomUserData(c->geom.g2)->ph_object)->ActorMovable() :
243 static_cast<CPHCharacter*>(retrieveGeomUserData(c->geom.g1)->ph_object)->ActorMovable()))
244 {
245 dJointID contact_joint = dJointCreateContactSpecial(0, ContactGroup, c);
246 Enable();
247 CPHObject::Island().DActiveIsland()->ConnectJoint(contact_joint);
248 if (b1)
249 dJointAttach(contact_joint, dGeomGetBody(c->geom.g1), 0);
250 else
251 dJointAttach(contact_joint, 0, dGeomGetBody(c->geom.g2));
252 do_collide = false;
253 m_friction_factor *= 0.1f;
254 }
255}
256
257void CPHActorCharacter::ChooseRestrictionType(CPHCharacter::ERestrictionType my_type, float my_depth, CPHCharacter* ch)
258{

Callers

nothing calls this directly

Calls 11

find_ifClass · 0.85
EnableFunction · 0.85
dJointAttachFunction · 0.85
dGeomGetBodyFunction · 0.85
ActorMovableMethod · 0.80
ConnectJointMethod · 0.80
beginFunction · 0.50
endFunction · 0.50
testMethod · 0.45
DActiveIslandMethod · 0.45

Tested by

no test coverage detected