diff --git a/examples/ReducedDeformableDemo/FreeFall.cpp b/examples/ReducedDeformableDemo/FreeFall.cpp index 91667fc77..7995cb95b 100644 --- a/examples/ReducedDeformableDemo/FreeFall.cpp +++ b/examples/ReducedDeformableDemo/FreeFall.cpp @@ -157,7 +157,7 @@ void FreeFall::initPhysics() getDeformableDynamicsWorld()->addSoftBody(rsb); rsb->getCollisionShape()->setMargin(0.1); // rsb->scale(btVector3(1, 1, 1)); - rsb->translate(btVector3(0, 0.1, 0)); //TODO: add back translate and scale + rsb->translate(btVector3(0, 0, 0)); //TODO: add back translate and scale // rsb->setTotalMass(0.5); rsb->setStiffnessScale(0.5); rsb->setDamping(damping_alpha, damping_beta); @@ -183,11 +183,13 @@ void FreeFall::initPhysics() } // create a static rigid box as the ground { - btBoxShape* groundShape = createBoxShape(btVector3(btScalar(3.), btScalar(3.), btScalar(3.))); + btBoxShape* groundShape = createBoxShape(btVector3(btScalar(3), btScalar(3), btScalar(3))); + // btBoxShape* groundShape = createBoxShape(btVector3(btScalar(50), btScalar(50), btScalar(50))); m_collisionShapes.push_back(groundShape); btTransform groundTransform; groundTransform.setIdentity(); + // groundTransform.setOrigin(btVector3(0, -50, 0)); groundTransform.setOrigin(btVector3(0, 0, 6)); { btScalar mass(0.); diff --git a/src/BulletSoftBody/BulletReducedSoftBody/btReducedDeformableContactConstraint.cpp b/src/BulletSoftBody/BulletReducedSoftBody/btReducedDeformableContactConstraint.cpp index 2357f69a3..a87f111d2 100644 --- a/src/BulletSoftBody/BulletReducedSoftBody/btReducedDeformableContactConstraint.cpp +++ b/src/BulletSoftBody/BulletReducedSoftBody/btReducedDeformableContactConstraint.cpp @@ -77,7 +77,10 @@ btScalar btReducedDeformableRigidContactConstraint::solveConstraint(const btCont // btVector3 impulse_tangent = impulse - impulse_normal; std::cout << "impulse normal: " << impulse[0] << '\t' << impulse[1] << '\t' << impulse[2] << '\n'; if (dn > 0) + { + std::cout << "skip\n"; return 0; + } // btVector3 impulse = m_contact->m_c0 * (vr + m_total_normal_dv * infoGlobal.m_deformable_cfm + ((m_penetration > 0) ? m_penetration / infoGlobal.m_timeStep * cti.m_normal : btVector3(0, 0, 0))); // if (!infoGlobal.m_splitImpulse) // { @@ -129,7 +132,7 @@ btScalar btReducedDeformableRigidContactConstraint::solveConstraint(const btCont // } // impulse = impulse_normal + impulse_tangent; // apply impulse to deformable nodes involved and change their velocities - // impulse = btVector3(0, 0, -1e-2); + // impulse = btVector3(0, 10, 0); // impulse_normal = btVector3(0, 0, 0); // impulse_tangent = btVector3(0, 0, 0); applyImpulse(impulse); diff --git a/src/BulletSoftBody/btSoftBodyInternals.h b/src/BulletSoftBody/btSoftBodyInternals.h index 01b10ce32..2bf4b3262 100644 --- a/src/BulletSoftBody/btSoftBodyInternals.h +++ b/src/BulletSoftBody/btSoftBodyInternals.h @@ -1696,6 +1696,7 @@ struct btSoftColliders if (psb->m_reducedModel) { c.m_c0 = (psb->getImpulseFactor(n.index)).inverse(); + c.m_c1 = n.m_x - psb->getRigidTransform().getOrigin(); } else { @@ -1704,8 +1705,8 @@ struct btSoftColliders c.m_c0 = ImpulseMatrix(1, n.m_effectiveMass_inv, imb, iwi, ra); // c.m_c0 = ImpulseMatrix(1, ima, imb, iwi, ra); + c.m_c1 = ra; } - c.m_c1 = ra; } else if (cti.m_colObj->getInternalType() == btCollisionObject::CO_FEATHERSTONE_LINK) {