Simple btCollisionWorld usage.

marksibly
Posts: 4
Joined: Mon Oct 27, 2014 2:08 am

Simple btCollisionWorld usage.

Post by marksibly »

Hi,

I'm trying to use btCollisionWorld to do some simple line picking of btCollisionObjects, some of which are moving.

However, I don't seem to be able to update the objects. When I use btCollisionObject::setWorldTransform,(), it doesn't seem to update the collision object's location as this page reckons it should: http://bulletphysics.org/mediawiki-1.5. ... _Detection

What am I missing? Do I need to setup a full dynamics world and use rigidbodies for moving objects?

[edit]
Ok, just found btCollisionWorld::updateAAbbs() which fixed things for me, and it looks like there's an 'auto' mode.

Still, is this the right way to do it?
[/edit]

Bye!
Mark
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Simple btCollisionWorld usage.

Post by drleviathan »

That sounds correct. If you aren't "stepping" the world normally then there would be some methods that you would have to call manually.

I usually find the that the Bullet documentation doesn't provide enough info for method calls, such as expected units or acceptable ranges. The good things you can say about it is that it lists ALL methods for a class and provides links to derived and parent classes. However, for your specific case the docs have a rare gem of advice for calling btCollisionWorld::computeOverlappingPairs():

http://bulletphysics.org/Bullet/BulletF ... f18ba81098
marksibly
Posts: 4
Joined: Mon Oct 27, 2014 2:08 am

Re: Simple btCollisionWorld usage.

Post by marksibly »

Yes, docs could use some work...! Still, the source is all there and the demos are nice.

computerOverlappingPairs doesn't help in my situation, but I guess that's 'coz I'm using rayTest, not a ray collision object, so nothing will 'overlap' until I actually perform the rayTest?

There's also updateSingleAabb which seems to work and may be faster as I already have a list of 'dirty' collision objects.
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Simple btCollisionWorld usage.

Post by drleviathan »

I would guess that a ray test might actually rely on the broadphase data structure to make the test fast. If so then it would require that the AABB's are updated for correct results.