6dof constraint question

Post Reply
catchyid
Posts: 15
Joined: Thu Jul 30, 2015 2:12 pm

6dof constraint question

Post by catchyid »

Hi,
This is a beginner question. The code below creates a slider constraint using the generic D6 constraint:

btTransform trans;
trans.setIdentity();

//create 2 rigid bodies...
btRigidBody* staticRB = createRigidBody(0, trans, 0);
btRigidBody* dynamicRB = createRigidBody(mass, trans, shape);

//create 6dof constraint
btGeneric6DofConstraint* g6dof = new btGeneric6DofConstraint(*staticRB, *dynamicRB, trans, trans, true);

g6dof->setLinearLowerLimit(btVector3(-10, 0, 0));
g6dof->setLinearUpperLimit(btVector3(10, 0, 0));
g6dof->getTranslationalLimitMotor()->m_enableMotor[0] = true;
g6dof->getTranslationalLimitMotor()->m_targetVelocity[0] = 5.0f;

--
Now, my questions:
1-although m_targetVelocity[0] is +ve in x direction, the dynamic RB moves in -ve x direction?
2-in the constraint constructor, does it make any difference to use frame reference in A or B (i.e. the last parameter in the btGeneric6DofConstraint)? Is there any guideline?

Thanks,
Post Reply