chaoskane
08-02-2013 12:57:55
Hey ho,
I want to develop a little tank driver game. If you drive a tank, you have more than one rotation point, the middle the left linkage, the right linkage and everypoint between middle - left and middle - right. The result should be multiple rotation points, so changing the pivot I thougt. But how?
I know how I can do this in OGRE, but I'm using OgreBullet for physics and I try this two weeks now, and I nothing works for me.
Thats what I'm having so far:
How can I solve my Problem with OgreBullet?
I want to develop a little tank driver game. If you drive a tank, you have more than one rotation point, the middle the left linkage, the right linkage and everypoint between middle - left and middle - right. The result should be multiple rotation points, so changing the pivot I thougt. But how?
I know how I can do this in OGRE, but I'm using OgreBullet for physics and I try this two weeks now, and I nothing works for me.
Thats what I'm having so far:
_defaultMachineBody->getBulletRigidBody()->getMotionState()->getWorldTransform(_transform);
btVector3 walkDir = btVector3(0.0, 0.0, 0.0);
if(yawDir != 0){ // rotation, move left or right
_scalar += (btScalar(Radian(float(yawDir*time)).valueAngleUnits()*1.0/100));
_tutorialRotationValue += float(Radian(float(yawDir*time)).valueAngleUnits()*1.0/100);
_transform.setRotation(btQuaternion(btVector3(0.0, 1.0, 0.0), _scalar));
}
if(moveDir != 0){ // move machine forward or backward, depending on moveDir
walkDir += btVector3(0.0, 0.0, float(speed/* * time*/)); // speed includes moveDir
}
if(walkDir == btVector3(0.0, 0.0, 0.0)){
_defaultMachineBody->getBulletRigidBody()->setLinearVelocity(btVector3(0.0, 0.0, 0.0));
}else{
_defaultMachineBody->getBulletRigidBody()->setLinearVelocity(QmV3(walkDir, _transform.getRotation()));
}
_defaultMachineBody->getBulletRigidBody()->getMotionState()->setWorldTransform(_transform);
_defaultMachineBody->getBulletRigidBody()->setCenterOfMassTransform(_transform);
How can I solve my Problem with OgreBullet?