rotation of a tank (Ogre + Bullet + OgreBullet)

Post Reply
chaoskane
Posts: 1
Joined: Mon Feb 04, 2013 9:41 am

rotation of a tank (Ogre + Bullet + OgreBullet)

Post by chaoskane » Mon Feb 04, 2013 9:45 am

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.

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:

Code: Select all


_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?

Post Reply