Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sat Jun 23, 2012 4:31 pm 
Offline

Joined: Sat Jun 23, 2012 4:09 pm
Posts: 1
Hello, I just started implementing Bullet in my project with DirectX 9 and c++. I've read the manual and looked through the wiki, but I still can't find the answer to this. I want to only use the collision detection features, but I can't figure out how to update objects once they're added to my instance of btDiscreteDynamicsWorld. Currently I'm doing it every frame with btCollisionObject->SetTransform(), but no collisions are detected when I check, and I read somewhere that you can't update the transforms once they're added to the world and active.

Using only objects with btBoxShape as their shape, how do I update their positions every frame so that they collide when I do a contact test? I think I understand using stepSimulation() or performDiscreteCollisionDetection() to literally update/check everything. It's just the individual object movement that I'm confused about. Do you have to use motion states just for the collision detection?


If my question is already answered somewhere, I would really appreciate a link. Thanks for your time!


Top
 Profile  
 
PostPosted: Sun Jun 24, 2012 3:56 pm 
Offline

Joined: Thu Nov 24, 2011 3:08 pm
Posts: 8
You have to update the object's broadphase proxy. The broadphase proxies represent the bounding boxes of all your objects and are arranged in a tree structure. Any time that you move a static object, you have to update the aabb min/max in the broadphase, which requires an update to the actual tree structure.

Untested code:

btVector3 aabbmin, aabbmax;
yourObject->getCollisionShape()->getAabb(yourObject->getWorldTransform(), aabbmin, aabbmax); // extracts the object's min/max axis aligned bounding box world coordinates
yourBulletWorld->getBroadphase()->setAabb(yourObject->getBroadphaseHandle(), aabbmin, aabbmax, 0); // sets the proxy's aabb and updates the tree


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Google Feedfetcher and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group