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

Method InitContact

ogsr_engine/xrGame/PHSimpleCharacter.cpp:1391–1529  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

1389
1390/////////////////////////////////////////////////////////////////
1391void CPHSimpleCharacter::InitContact(dContact* c, bool& do_collide, u16 material_idx_1, u16 material_idx_2)
1392{
1393 const dReal* normal = c->geom.normal;
1394 const dReal* pos = c->geom.pos;
1395 const dGeomID g1 = c->geom.g1;
1396 const dGeomID g2 = c->geom.g2;
1397 bool bo1 = (g1 == m_wheel) || g1 == m_cap_transform || g1 == m_shell_transform || g1 == m_hat_transform;
1398
1399 // SGameMtl* tri_material=GMLib.GetMaterialByIdx((u16)c->surface.mode);
1400
1401 u16 contact_material = bo1 ? material_idx_2 : material_idx_1;
1402 SGameMtl* tri_material = GMLib.GetMaterialByIdx(contact_material);
1403
1404 bool bClimable = !!tri_material->Flags.test(SGameMtl::flClimable);
1405 if (is_control && m_elevator_state.ClimbingState())
1406 {
1407 c->surface.mu = 0.f;
1408 c->surface.soft_cfm = world_cfm * 2.f;
1409 c->surface.soft_erp = world_erp;
1410 b_any_contacts = true;
1411 is_contact = true;
1412 }
1413 u16 foot_material_idx = ((dxGeomUserData*)dGeomGetData(m_wheel))->tri_material;
1414 if (tri_material->Flags.test(SGameMtl::flPassable) && !do_collide)
1415 {
1416 UpdateStaticDamage(c, tri_material, bo1);
1417 foot_material_update(contact_material, foot_material_idx);
1418 return;
1419 }
1420 if (do_collide)
1421 {
1422 b_any_contacts = true;
1423 is_contact = true;
1424 }
1425 dReal spring_rate = def_spring_rate;
1426 dReal dumping_rate = def_dumping_rate;
1427 bool object = (dGeomGetBody(g1) && dGeomGetBody(g2));
1428 b_on_object = b_on_object || object;
1429
1430 ////////////////////////нужно сместить колижен!!
1431 //////////////
1432 FootProcess(c, do_collide, bo1);
1433 if (!do_collide)
1434 return;
1435 if (g1 == m_hat_transform || g2 == m_hat_transform)
1436 {
1437 b_side_contact = true;
1438 MulSprDmp(c->surface.soft_cfm, c->surface.soft_erp, spring_rate, dumping_rate);
1439 c->surface.mu = 0.00f;
1440 }
1441
1442 if (object)
1443 {
1444 spring_rate *= 10.f;
1445 dBodyID b;
1446 u16 obj_material_idx = u16(-1);
1447 if (bo1)
1448 {

Callers

nothing calls this directly

Calls 9

dGeomGetDataFunction · 0.85
dGeomGetBodyFunction · 0.85
MulSprDmpFunction · 0.85
dVectorSetFunction · 0.85
dXZDotFunction · 0.85
cast_fpFunction · 0.85
dVectorSetInvertFunction · 0.85
ClimbingStateMethod · 0.80
testMethod · 0.45

Tested by

no test coverage detected