Some collisions not working on 2.75

Post Reply
bcsanches
Posts: 10
Joined: Mon Feb 02, 2009 2:15 pm

Some collisions not working on 2.75

Post by bcsanches »

Hello folks,

I just migrated to bullet 2.75 and some of my collisions stopped working. If I simple recompile my project using version 2.74 everything works fine.

The collisions are between dynamic rigid bodies (boxes) and meshes, also actors (kinematic capsule) against mesh.

Note that only some objects do not collide anymore, the others works fine.

Any tips how I can debug this?

Thank you
Bruno Sanches
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Some collisions not working on 2.75

Post by Erwin Coumans »

The axis aligned bounding box (AABB) of static objects are not automatically updated after being added to the dynamics world.

Can you verify if this is your problem, by commenting out line 165 in Bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp?

Code: Select all

void	btCollisionWorld::updateAabbs()
{
	BT_PROFILE("updateAabbs");

	btTransform predictedTrans;
	for ( int i=0;i<m_collisionObjects.size();i++)
	{
		btCollisionObject* colObj = m_collisionObjects[i];

		//only update aabb of active objects
//		if (colObj->isActive())
		{
			updateSingleAabb(colObj);
		}
	}
}
If so, please add the line

Code: Select all

world-> updateSingleAabb(object);
after you changed static objects.

Hope this helps,
Erwin
bcsanches
Posts: 10
Joined: Mon Feb 02, 2009 2:15 pm

Re: Some collisions not working on 2.75

Post by bcsanches »

Erwin,

this fixed the issue :).

Some static objects get updated after being added to the world due to my load process, but now I simple force a AABB update when this happens.

Thank you!

Cheers
Bruno Sanches
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Some collisions not working on 2.75

Post by Erwin Coumans »

To avoid such problems, the optimizations has been disabled by default.

Developers have to explicitly make a call to enable the optimization using

Code: Select all

///enable optimization: only update the axis aligned bounding box of active objects
world->setForceUpdateAllAabbs(false);
An updated Bullet 2.75 will be re-uploaded right now.
Thanks for the report,
Erwin
bcsanches
Posts: 10
Joined: Mon Feb 02, 2009 2:15 pm

Re: Some collisions not working on 2.75

Post by bcsanches »

Thats great!

I updated mine here and did the testing:
1 - Disabled my changes (that updated static objects AABB) and tried it: worked without any issue
2 - Called world->setForceUpdateAllAabbs(false) and ran it again, as expected the "errors" came back
3 - Enabled my changes (now static AABB is updated when objects move) and it worked again without issues.

I do not know bullet implementation details and this may sound stupid, but how about adding a dirty flag to the objects? When we change its transform it turns ON the flag and that loop that updates AABB may check that flag also.

Just my 2 cents :).

Thank you

Cheers
Bruno Sanches
Zenja
Posts: 14
Joined: Fri Jul 10, 2009 4:48 am

Re: Some collisions not working on 2.75

Post by Zenja »

Erwin Coumans wrote:To avoid such problems, the optimizations has been disabled by default.

Developers have to explicitly make a call to enable the optimization using

Code: Select all

///enable optimization: only update the axis aligned bounding box of active objects
world->setForceUpdateAllAabbs(false);
An updated Bullet 2.75 will be re-uploaded right now.
Thanks for the report,
Erwin
Just out of curiosity, is there a definitive list which specifies all of these optimisation settings we can toggle to get the best possible speed? I've discovered some profiling macros by accident which are ON by default, and being short on hardware resources (as most game developers are), I'd love to run a leaner/faster version of Bullet. Knowing exactly what to toggle/disable would really help game developers.

Cheers,
Zenja
(void*)
Posts: 6
Joined: Tue Sep 15, 2009 2:32 pm

Re: Some collisions not working on 2.75

Post by (void*) »

"discovered some profiling macros by accident which are ON by default"

So.... which macros were they?
Zenja
Posts: 14
Joined: Fri Jul 10, 2009 4:48 am

Re: Some collisions not working on 2.75

Post by Zenja »

LinearMath/btQuickprof.h/line 19,

//#define BT_NO_PROFILE
Post Reply