diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2006-02-22 09:58:05 +0300 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2006-02-22 09:58:05 +0300 |
commit | c2782ce10e00535f92921432f79ae00bf750509a (patch) | |
tree | 05e80e1cf88b2ec73bb3b7a7b0d2953b0e8368ef /source/gameengine/Physics/Bullet | |
parent | dcb751725ed3057c29aca57f04479ef9a4380d82 (diff) |
added 'disable sleeping' option for rigidbodies. + bugfix of out of sync wheels for vehicle
Diffstat (limited to 'source/gameengine/Physics/Bullet')
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsController.cpp | 6 | ||||
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp | 15 |
2 files changed, 12 insertions, 9 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index 2f8f4a4e2ab..fdb30faa5cf 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -374,9 +374,8 @@ void CcdPhysicsController::setNewClientInfo(void* clientinfo) void CcdPhysicsController::UpdateDeactivation(float timeStep) { - if ( (m_body->GetActivationState() == 2)) + if ( (m_body->GetActivationState() == ISLAND_SLEEPING) || (m_body->GetActivationState() == DISABLE_DEACTIVATION)) return; - if ((m_body->getLinearVelocity().length2() < gLinearSleepingTreshold*gLinearSleepingTreshold) && (m_body->getAngularVelocity().length2() < gAngularSleepingTreshold*gAngularSleepingTreshold)) @@ -393,6 +392,9 @@ void CcdPhysicsController::UpdateDeactivation(float timeStep) bool CcdPhysicsController::wantsSleeping() { + if (m_body->GetActivationState() == DISABLE_DEACTIVATION) + return false; + //disable deactivation if (gDisableDeactivation || (gDeactivationTime == 0.f)) return false; diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index b39591fc627..7bc2eb73cbc 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -115,6 +115,7 @@ public: { WheelInfo& info = m_vehicle->GetWheelInfo(i); PHY_IMotionState* motionState = (PHY_IMotionState*)info.m_clientInfo ; + m_vehicle->UpdateWheelTransform(i); SimdTransform trans = m_vehicle->GetWheelTransformWS(i); SimdQuaternion orn = trans.getRotation(); const SimdVector3& pos = trans.getOrigin(); @@ -668,6 +669,10 @@ bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep) { break; } + case DISABLE_DEACTIVATION: + { + color.setValue(1,0,1); + }; }; @@ -751,7 +756,8 @@ bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep) body->SetActivationState( WANTS_DEACTIVATION ); } else { - body->SetActivationState( ACTIVE_TAG ); + if (body->GetActivationState() != DISABLE_DEACTIVATION) + body->SetActivationState( ACTIVE_TAG ); } if (useIslands) @@ -785,12 +791,7 @@ bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep) for (int i=0;i<numVehicles;i++) { WrapperVehicle* wrapperVehicle = m_wrapperVehicles[i]; - - for (int j=0;j<wrapperVehicle->GetVehicle()->GetNumWheels();j++) - { - wrapperVehicle->GetVehicle()->UpdateWheelTransform(j); - } - + wrapperVehicle->SyncWheels(); } #endif //NEW_BULLET_VEHICLE_SUPPORT |