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

Method solveContactsAndConstraints

src/engine/PhysicsWorld.cpp:321–345  ·  view source on GitHub ↗

Solve the contacts and constraints

Source from the content-addressed store, hash-verified

319
320// Solve the contacts and constraints
321void PhysicsWorld::solveContactsAndConstraints(decimal timeStep) {
322
323 RP3D_PROFILE("PhysicsWorld::solveContactsAndConstraints()", mProfiler);
324
325 // ---------- Solve velocity constraints for joints and contacts ---------- //
326
327 // Initialize the contact solver
328 mContactSolverSystem.init(mCollisionDetection.mCurrentContactManifolds, mCollisionDetection.mCurrentContactPoints, timeStep);
329
330 // Initialize the constraint solver
331 mConstraintSolverSystem.initialize(timeStep);
332
333 // For each iteration of the velocity solver
334 for (uint32 i=0; i<mNbVelocitySolverIterations; i++) {
335
336 mConstraintSolverSystem.solveVelocityConstraints();
337
338 mContactSolverSystem.solve();
339 }
340
341 mContactSolverSystem.storeImpulses();
342
343 // Reset the contact solver
344 mContactSolverSystem.reset();
345}
346
347// Solve the position error correction of the constraints
348void PhysicsWorld::solvePositionCorrection() {

Callers

nothing calls this directly

Calls 6

initializeMethod · 0.80
solveMethod · 0.80
storeImpulsesMethod · 0.80
initMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected