MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / updatePhysics

Method updatePhysics

testbed/scenes/bridge/BridgeScene.cpp:81–99  ·  view source on GitHub ↗

Update the physics simulation

Source from the content-addressed store, hash-verified

79
80// Update the physics simulation
81void 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
102void BridgeScene::createPhysicsWorld() {

Callers

nothing calls this directly

Calls 4

destroyJointMethod · 0.80
sizeMethod · 0.45
lengthSquareMethod · 0.45
getReactionForceMethod · 0.45

Tested by

no test coverage detected