reduce the AABB for spheres

Post Reply
CarinaCruz
Posts: 21
Joined: Wed Mar 25, 2015 2:04 pm

reduce the AABB for spheres

Post by CarinaCruz »

Hello!

There's a way to change the size of the AABB of the objects? I have to lay a finger on a sphere and know when it happened, but the collision information occurs before, in fact, the finger lay in the sphere. Because the collision is detected when the finger enters the sphere AABB.

The figure below shows, more or less, what's going on.

If anyone can help me, I thank!

:roll: :roll: :roll: :roll:
Attachments
esfera.png
esfera.png (6.22 KiB) Viewed 4556 times
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: reduce the AABB for spheres

Post by drleviathan »

You're detecting the "collision" incorrectly. The recommended way to do it is to scan the contact manifold lists and keep a map of existing pairs of objects. When a new pair shows up then you would fire off a collision "start" event. Unfortunately such a system is not one of the default Bullet features and must be a custom implementation. There is a good example that was posted on these forums a while ago.

The AABB can't be made any smaller for the sphere. The object's AABB is used in the broadphase overlapping pair logic and if any part of the sphere were to extend outside its AABB then some real narrow-phase collisions would be missed because the broadphase would incorrectly fail early.
CarinaCruz
Posts: 21
Joined: Wed Mar 25, 2015 2:04 pm

Re: reduce the AABB for spheres

Post by CarinaCruz »

Thanks for the answer drleviathan.

I'll search the post.

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

Re: reduce the AABB for spheres

Post by drleviathan »

Oh hey, I also did a search and found this old post, although that wasn't the one I was thinking about.
CarinaCruz
Posts: 21
Joined: Wed Mar 25, 2015 2:04 pm

Re: reduce the AABB for spheres [SOLVED]

Post by CarinaCruz »

Hi drleviathan!

Thanks for the post!

I was on the right track, but was missing the line:

Code: Select all

btManifoldPoint &pt = contactManifold->getContactPoint(j);
	if(pt.getDistance() < 0.f){

        }

Now the callback is working all right!
Post Reply