Page 1 of 1

reduce the AABB for spheres

Posted: Wed Jul 08, 2015 4:17 pm
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:

Re: reduce the AABB for spheres

Posted: Thu Jul 09, 2015 6:00 am
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.

Re: reduce the AABB for spheres

Posted: Thu Jul 09, 2015 1:06 pm
by CarinaCruz
Thanks for the answer drleviathan.

I'll search the post.

:)

Re: reduce the AABB for spheres

Posted: Thu Jul 09, 2015 1:15 pm
by drleviathan
Oh hey, I also did a search and found this old post, although that wasn't the one I was thinking about.

Re: reduce the AABB for spheres [SOLVED]

Posted: Mon Jul 13, 2015 3:11 pm
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!