I'm doing OK, but I have a couple of issues.
My car uses a 6dof for each wheel, however when the friction is high and I bank sharply the wheel angles sideways against the ground.. Of course I'd like the wheel to remain perpendicular to the ground at all times.. the below screenshot shows the problem.

Sorry for poor quality.
This is a similar to the below post, but I have been unable to fix it..
http://bulletphysics.org/Bullet/phpBB3/ ... f=9&t=3402
I've tried adjusting CFM with setParam, setting angularFactor (but this is global space) without success.
I'm curious why this happens even though I've locked the limits on the 6dof.
This is my basic configuration.
Code: Select all
void BulletFramework::createWheelSuspensionJoint(MdlParser::mdl_joint joint, int oid_a, int oid_b) {
btVector3 posa = btVector3(joint.position[0],joint.position[1],joint.position[2]);
btVector3 posb = btVector3(0.0,0.0,0.0);
btVector3 axis = btVector3(joint.axis[0],joint.axis[1],joint.axis[2]);
btQuaternion rota = btrigidbodies[oid_a]->getOrientation();
btQuaternion rotb; rotb.setEuler(joint.axis[0],joint.axis[1],joint.axis[2]);
btTransform transformA = btTransform(rota,posa);
btTransform transformB = btTransform(rotb,posb);
btGeneric6DofSpringConstraint* hingeConstraint = new btGeneric6DofSpringConstraint(*btrigidbodies[oid_a],*btrigidbodies[oid_b], transformA, transformB, true);
const btScalar low = 0;
const btScalar high = 0;
hingeConstraint->setLimit( 0, low, high );
hingeConstraint->setLimit( 1, joint.suspension_limit[0], joint.suspension_limit[1] );
hingeConstraint->setLimit( 2, low, high );
hingeConstraint->setLimit( 3, 1, 0 );
hingeConstraint->setLimit( 4, -joint.steer_limit, joint.steer_limit );
// hingeConstraint->setLimit( 4, low, high );
hingeConstraint->setLimit( 5, low, high );
hingeConstraint->setLimit( 6, low, high );
// hingeConstraint->setParam(BT_CONSTRAINT_STOP_CFM, 0, 4);
// hingeConstraint->setParam(BT_CONSTRAINT_CFM, 0);
// hingeConstraint->setAngularUpperLimit(btVector3(0., 0., 0.));
// hingeConstraint->setAngularLowerLimit(btVector3(0., 0., 0.));
hingeConstraint->enableSpring( 1, true );
hingeConstraint->setStiffness( 1, joint.suspension_stiffness );
hingeConstraint->setEquilibriumPoint(1,joint.suspension_equilibrium);
const bool isDisableCollisionsBetweenLinkedBodies = true;
bulletworld->addConstraint( hingeConstraint, isDisableCollisionsBetweenLinkedBodies );
bt6dofconstraints.push_back(hingeConstraint);
bConstraint thisConstraint;
thisConstraint.c_id = constraint_id++;
thisConstraint.type = "bt6dofconstraint";
bConstraints.push_back(thisConstraint);
cout << "c_id " << constraint_id << endl;
}
update: Erwins suggestion to use
Code: Select all
constraint->setOverrideNumSolverIterations(40);