| 397 | VERIFY_BOUNDARIES2(cast_fv(dBodyGetPosition(m_body)), phBoundaries, PhysicsRefObject(), "PhTune body position"); |
| 398 | } |
| 399 | void CPHElement::PhDataUpdate(dReal step) |
| 400 | { |
| 401 | if (!isActive()) |
| 402 | return; |
| 403 | |
| 404 | if (isFixed()) |
| 405 | { |
| 406 | dBodySetLinearVel(m_body, 0, 0, 0); |
| 407 | dBodySetAngularVel(m_body, 0, 0, 0); |
| 408 | dBodySetForce(m_body, 0, 0, 0); |
| 409 | dBodySetTorque(m_body, 0, 0, 0); |
| 410 | return; |
| 411 | } |
| 412 | |
| 413 | ///////////////skip for disabled elements//////////////////////////////////////////////////////////// |
| 414 | // b_enabled_onstep=!!dBodyIsEnabled(m_body); |
| 415 | // VERIFY_BOUNDARIES2(cast_fv(dBodyGetPosition(m_body)),phBoundaries,PhysicsRefObject(),"PhDataUpdate begin, body position"); |
| 416 | #ifdef DEBUG |
| 417 | if (ph_dbg_draw_mask.test(phDbgDrawMassCenters)) |
| 418 | { |
| 419 | DBG_DrawPoint(cast_fv(dBodyGetPosition(m_body)), 0.03f, D3DCOLOR_XRGB(255, 0, 0)); |
| 420 | } |
| 421 | #endif |
| 422 | |
| 423 | m_flags.set(flEnabledOnStep, !!dBodyIsEnabled(m_body)); |
| 424 | if (!m_flags.test(flEnabledOnStep) /*!b_enabled_onstep*/) |
| 425 | return; |
| 426 | |
| 427 | //////////////////////////////////base pointers///////////////////////////////////////////////// |
| 428 | const dReal* linear_velocity = dBodyGetLinearVel(m_body); |
| 429 | const dReal* angular_velocity = dBodyGetAngularVel(m_body); |
| 430 | |
| 431 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 432 | ///////////////scale velocity/////////////////////////////////////////////////////////////////////////////////////// |
| 433 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 434 | VERIFY(dV_valid(linear_velocity)); |
| 435 | #ifdef DEBUG |
| 436 | if (!dV_valid(angular_velocity)) |
| 437 | { |
| 438 | Msg("angular vel %f,%f,%f", angular_velocity[0], angular_velocity[1], angular_velocity[2]); |
| 439 | Msg("linear vel %f,%f,%f", linear_velocity[0], linear_velocity[1], linear_velocity[2]); |
| 440 | Msg("position %f,%f,%f", dBodyGetPosition(m_body)[0], dBodyGetPosition(m_body)[1], dBodyGetPosition(m_body)[2]); |
| 441 | Msg("quaternion %f,%f,%f,%f", dBodyGetQuaternion(m_body)[0], dBodyGetQuaternion(m_body)[1], dBodyGetQuaternion(m_body)[2], dBodyGetQuaternion(m_body)[3]); |
| 442 | Msg("matrix"); |
| 443 | Msg("x %f,%f,%f", dBodyGetRotation(m_body)[0], dBodyGetRotation(m_body)[4], dBodyGetRotation(m_body)[8]); |
| 444 | Msg("y %f,%f,%f", dBodyGetRotation(m_body)[1], dBodyGetRotation(m_body)[5], dBodyGetRotation(m_body)[9]); |
| 445 | Msg("z %f,%f,%f", dBodyGetRotation(m_body)[2], dBodyGetRotation(m_body)[6], dBodyGetRotation(m_body)[10]); |
| 446 | CPhysicsShellHolder* ph = PhysicsRefObject(); |
| 447 | Msg("name visual %s", *ph->cNameVisual()); |
| 448 | Msg("name obj %s", ph->Name()); |
| 449 | Msg("name section %s", *ph->cNameSect()); |
| 450 | VERIFY2(0, "bad angular velocity"); |
| 451 | } |
| 452 | #endif |
| 453 | VERIFY(!fis_zero(m_l_scale)); |
| 454 | VERIFY(!fis_zero(m_w_scale)); |
| 455 | dBodySetLinearVel(m_body, linear_velocity[0] / m_l_scale, linear_velocity[1] / m_l_scale, linear_velocity[2] / m_l_scale); |
| 456 | dBodySetAngularVel(m_body, angular_velocity[0] / m_w_scale, angular_velocity[1] / m_w_scale, angular_velocity[2] / m_w_scale); |
nothing calls this directly
no test coverage detected