Tks in advance,
Cheers!
Code: Select all
...
...
camera->shape = new btCylinderShapeZ( btVector3( 1.0, 0.0, 2.0 ) );
camera->shape->setMargin( 0.5 );
trans.setIdentity();
camera->motion = new btDefaultMotionState( trans );
camera->shape->calculateLocalInertia( 80.0, inertia );
camera->body = new btRigidBody( 80.0, camera->motion, camera->shape, inertia,
(btScalar)10.0,
(btScalar)10.0,
(btScalar)10.0,
(btScalar)10.0 );
camera->body->setAngularFactor( 0.0 );
world->addRigidBody( camera->body );
...
...
// Front & Back ~ Working but because of the translation motion when
// I go to a corner and forward I got some major jaggin....
camera->body->translate( btVector3( ( _dir * camera->dir->x ) / camera->speed,
( _dir * camera->dir->y ) / camera->speed,
0.0 ) );
/*
// Work but cannot stay stable when climbing stairs
camera->body->internalApplyImpulse( btVector3( -camera->vel->x,
-camera->vel->y,
0.5 ),
btVector3( 0.0, 0.0, 0.0 ),
0.25 );
*/
/*
// Work but cannot climb stairs or ramps ( this is the one that give the most smooth result but...)
camera->body->internalApplyImpulse( btVector3( -camera->vel->x,
-camera->vel->y,
0.0 ),
btVector3( 0.0, 0.0, 0.0 ),
0.25 );
*/
/*
// Work but cannot climb stairs or ramps
camera->body->applyImpulse( btVector3( -camera->vel->x * camera->speed,
-camera->vel->y * camera->speed,
-1.0 ),
btVector3( camera->pos->x,
camera->pos->y,
camera->pos->z ) );
*/
/*
// Work but cannot climb stairs or ramps
camera->body->setLinearVelocity( btVector3( -camera->vel->x * camera->speed,
-camera->vel->y * camera->speed,
-10.0 ) );
*/
...
...