| 469 | void CPHSimpleCharacter::ApplyForce(const Fvector& dir, float force) { ApplyForce(dir.x * force, dir.y * force, dir.z * force); } |
| 470 | |
| 471 | void CPHSimpleCharacter::PhDataUpdate(dReal /**step/**/) |
| 472 | { |
| 473 | /////////////////// |
| 474 | |
| 475 | SafeAndLimitVelocity(); |
| 476 | |
| 477 | if (!dBodyIsEnabled(m_body)) |
| 478 | { |
| 479 | if (!ph_world->IsFreezed()) |
| 480 | b_lose_control = false; |
| 481 | return; |
| 482 | } |
| 483 | if (is_contact && !is_control && !b_lose_ground) |
| 484 | Disabling(); |
| 485 | |
| 486 | /////////////////////// |
| 487 | if (ph_world->m_steps_num > m_ext_impuls_stop_step) |
| 488 | { |
| 489 | b_external_impulse = false; |
| 490 | m_ext_impuls_stop_step = u64(-1); |
| 491 | m_ext_imulse.set(0, 0, 0); |
| 492 | Fvector vel; |
| 493 | GetVelocity(vel); |
| 494 | dVectorLimit(cast_fp(vel), m_max_velocity, cast_fp(vel)); |
| 495 | SetVelocity(Fvector().set(0, 0, 0)); |
| 496 | } |
| 497 | was_contact = is_contact; |
| 498 | was_control = is_control; |
| 499 | b_was_side_contact = b_side_contact; |
| 500 | is_contact = false; |
| 501 | b_side_contact = false; |
| 502 | b_any_contacts = false; |
| 503 | b_valide_ground_contact = false; |
| 504 | b_valide_wall_contact = false; |
| 505 | |
| 506 | b_was_on_object = b_on_object; |
| 507 | b_on_object = false; |
| 508 | b_death_pos = false; |
| 509 | m_contact_count = 0; |
| 510 | m_friction_factor = 0.f; |
| 511 | b_collision_restrictor_touch = false; |
| 512 | b_foot_mtl_check = true; |
| 513 | dMatrix3 R; |
| 514 | dRSetIdentity(R); |
| 515 | dBodySetAngularVel(m_body, 0.f, 0.f, 0.f); |
| 516 | dBodySetRotation(m_body, R); |
| 517 | |
| 518 | dMass mass; |
| 519 | const float* linear_velocity = dBodyGetLinearVel(m_body); |
| 520 | dReal linear_velocity_mag = _sqrt(dDOT(linear_velocity, linear_velocity)); |
| 521 | dBodyGetMass(m_body, &mass); |
| 522 | dReal l_air = linear_velocity_mag * default_k_l; // force/velocity !!! |
| 523 | if (l_air > mass.mass / fixed_step) |
| 524 | l_air = mass.mass / fixed_step; // validate |
| 525 | |
| 526 | if (!fis_zero(l_air)) |
| 527 | dBodyAddForce(m_body, -linear_velocity[0] * l_air, -linear_velocity[1] * l_air, -linear_velocity[2] * l_air); |
| 528 | m_last_move.sub(cast_fv(dBodyGetPosition(m_body)), m_last_move); |
nothing calls this directly
no test coverage detected