I am trying to figure out why my objects are floating apart from each other instead of next to each other.
Code: Select all
////btHingeConstraint* testConstraint = new btHingeConstraint(*squareTest->getEntityRigidBody(), *gear2->getEntityRigidBody(), btVector3(0, 0, 0), btVector3(0, Ogre::Math::PI * 2, 0), btVector3(0, 0, 0), btVector3(0, 1, 0), true);
btTransform localA, localB;
localA.setIdentity();
localB.setIdentity();
localA.getBasis().setEulerZYX(0, 0, 0);
localA.setOrigin(btVector3(0.0, 0, 0));
localB.getBasis().setEulerZYX(0, 0, 0);
localB.setOrigin(btVector3(0.0, 0, 0));
btHingeConstraint* testConstraint = new btHingeConstraint(*gear2->getEntityRigidBody(), *squareTest->getEntityRigidBody(), localA, localB, false);
//btHingeConstraint* testConstraint = new btHingeConstraint(*gear2->getEntityRigidBody(), *squareTest->getEntityRigidBody(), btVector3(0, 0, 0), btVector3(0, 0, 0), btVector3(0, 0, 0), btVector3(0, 0, 0), false);
testConstraint->setAxis(btVector3(0, 1, 0));
testConstraint->enableAngularMotor(true, 6, 3);
dynamicsWorld->addConstraint(testConstraint);

I had all of the gears working together when they were attached just to the world in blank space, but trying to attach them to a cube is proving most frustrating.

If anyone could explain the hinge constraint a bit more and why it may be moving the location of my gears so that they no longer line up as they should, that would be excellent.