Update the physics simulation
| 79 | |
| 80 | // Update the physics simulation |
| 81 | void BridgeScene::updatePhysics() { |
| 82 | |
| 83 | SceneDemo::updatePhysics(); |
| 84 | |
| 85 | // Test if the joints of the last bridge should break or not |
| 86 | for (int i=0; i <NB_BOXES-1; i++) { |
| 87 | |
| 88 | const uint jointIndex = mHingeJoints.size() - 1 - i; |
| 89 | rp3d::HingeJoint* joint = mHingeJoints[jointIndex]; |
| 90 | |
| 91 | if (joint != nullptr) { |
| 92 | |
| 93 | if (joint->getReactionForce(mEngineSettings.timeStep.count()).lengthSquare() > 60000000) { |
| 94 | mPhysicsWorld->destroyJoint(joint); |
| 95 | mHingeJoints[jointIndex] = nullptr; |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | // Create the physics world |
| 102 | void BridgeScene::createPhysicsWorld() { |
nothing calls this directly
no test coverage detected