これがあなたの求めているものかどうかはわかりませんが、これは基本的な剛体物理学のセットアップ コードです。
#include "btBulletDynamicsCommon.h"
...
m_pBroadphase = new btDbvtBroadphase();
m_pCollisionConfig = new btDefaultCollisionConfiguration();
m_pCollisionDispatcher = new btCollisionDispatcher(m_pCollisionConfig);
m_pSolver = new btSequentialImpulseConstraintSolver();
m_pDynamicsWorld = new btDiscreteDynamicsWorld(m_pCollisionDispatcher,
m_pBroadphase,
m_pSolver,
m_pCollisionConfig);
後は、世界に体を追加するだけの問題です...
btRigidBody::btRigidBodyConstructionInfo info;
// set physical properties like mass, coefficient of restitution etc
info.m_mass = 10;
info.m_restitution = 0.5;
...
// Use a motion state to link the physics body with the graphics object.
// This is the glue between Bullet and your code, called by bullet to update the
// position & orientation of the object
info.m_motionState = new YourCustomMotionState(...) ;
btRigidBody* pRigidBody = new btRigidBody(info);
m_pDynamicsWorld->addRigidBody(pRigidBody);
...そして、フレームごとに世界の状態を更新します。
m_pDynamicsWorld->stepSimulation(deltaTime, m_maxSubSteps);
これにより、物体の動きを制御する Bullet を使用して、互いに衝突して跳ね返る剛体を使用した単純な物理シミュレーションが得られます。