32 #include <QMutexLocker> 45 BulletWorldManager::BulletWorldManager() {
46 m_name =
"Body-Fixed-Coordinate-System";
56 BulletWorldManager::BulletWorldManager(
const QString &name) {
65 BulletWorldManager::~BulletWorldManager() { }
73 QString BulletWorldManager::name()
const {
83 int BulletWorldManager::size()
const{
84 return ( m_world->getCollisionObjectArray().size() );
96 btAssert( index < size() );
97 btAssert( index >= 0 );
98 return ( (
BulletTargetShape *) (m_world->getCollisionObjectArray().at(index)->getUserPointer()) );
111 QString v_name = name.toLower();
112 const btCollisionObjectArray &btobjects = m_world->getCollisionObjectArray();
113 for (
int i = 0 ; i < btobjects.size() ; i++ ) {
115 if ( target->
name().toLower() == v_name ) {
135 m_world->addCollisionObject( target->
body() );
156 bool BulletWorldManager::raycast(
const btVector3 &rayStart,
const btVector3 &rayEnd,
157 btCollisionWorld::RayResultCallback &results )
const {
158 m_world->rayTest(rayStart, rayEnd, results);
159 return ( results.hasHit() );
168 const btCollisionWorld &BulletWorldManager::getWorld()
const {
178 void BulletWorldManager::initWorld() {
179 m_collision.reset(
new btDefaultCollisionConfiguration() );
180 m_dispatcher.reset(
new btCollisionDispatcher(m_collision.data()) );
181 m_broadphase.reset(
new btDbvtBroadphase() );
182 m_world.reset(
new btCollisionWorld( m_dispatcher.data(), m_broadphase.data(), m_collision.data() ) );
btCollisionObject * body() const
Return a pointer to the Bullet target object/shape.
Namespace for the standard library.
QString name() const
Return name of the target shape.
Namespace for ISIS/Bullet specific routines.
Bullet Target Shape for planetary bodies.