How to move a kinematic body?

Please don't post Bullet support questions here, use the above forums instead.
Post Reply
Posts: 21
Joined: Fri Jan 20, 2017 10:44 pm

How to move a kinematic body?

Post by i7.strelok » Sat Jun 03, 2017 4:30 pm

I try to develop my FPS-Game, I need to move the player, but if I use dynamic-body, I change its rotation too, I think that I need to use the kinematic-body, but ... how to move the kinematic body ? Or How to disable the other axes?

Code: Select all

void PlayState::createPlayer(){

   Vector3 size = Vector3::ZERO;	// size of the box
  Vector3 position = _nodePerson->_getDerivedPosition();
  position.y +=2;
  Ogre::Quaternion rotation = _nodePerson->_getDerivedOrientation();
  // Obtenemos la bounding box de la entidad creada... ------------
  AxisAlignedBox boundingB = _sceneMgr->getEntity("BoxPlayer")->getBoundingBox();
  size = boundingB.getSize();
 // size.y*=2;
  size /= 2.0f;   // El tamano en Bullet se indica desde el centro
  // after that create the Bullet shape with the calculated size
  OgreBulletCollisions::BoxCollisionShape *boxShape = new 
  // and the Bullet rigid body
  _rigidBox = new 
    OgreBulletDynamics::RigidBody("rigidBox", _world);

  _rigidBox->setShape(_nodePerson, boxShape,
		     0 /* Restitucion */, 0 /* Friccion */,
		     30 /* Masa */, position /* Posicion inicial */,
		     rotation /* Orientacion */);

  _camera->getDerivedDirection().normalisedCopy() * 3.0); 
  // Anadimos los objetos a las deques
  _shapes.push_back(boxShape);   _bodies.push_back(_rigidBox);


Code: Select all


Wrapper: OgreBullet

Post Reply