Update speed of objects

mmic
Posts: 6
Joined: Thu Jul 11, 2013 8:34 pm

Update speed of objects

Post by mmic »

Hello! I'm designing an application with Bullet and Ogre. I need to upgrade the speed of all objects according to the following formula:

new_velocity_vector = old_velocity_vector * dt

I thought I would update the speed this way:

Code: Select all

...
while (! this-> mShutDown) {
  mKeyboard-> capture ();
  mMouse-> capture ();

  dynamicsWorld-> stepSimulation (1/60.f, 10);

  for (int k = 1; k < this-> bodies_.size () k ++) {
    btScalar  x = vel.getX () * dt;
    btScalar  y = vel.getY () * dt;
    btScalar  z = vel.getZ () * dt

    this-> bodies_ [k] -> setLinearVelocity (btVector3 (x, y, z));
  }
  mroot-> renderOneFrame ();
}
...
is the right way to do it? For updates objects I'm using the MotionState.