aabb box issue with trianglemesh

Post Reply
eagletree
Posts: 28
Joined: Sun Jul 31, 2011 11:20 pm

aabb box issue with trianglemesh

Post by eagletree »

My level is a btTriangleIndexVertexArray created from an irrlicht mesh. The level looks good, including bounding box in both irrlicht and bullet. In a maximum of 1 out of 3 executions (sometimes less often like 1 out of 5), I get the following error:
Overflow in AABB, object removed from simulation
If you can reproduce this, please email bugs@continuousphysics.com

Please include above information, your Platform, version of OS.

Thanks.
I followed the instructions and received no reply. I presume it's a very old message and not to be taken seriously that this is a bullet bug.

In Debug, I followed this to a chunk of code in btCollisionWorld.cpp as follows:

Code: Select all

	//moving objects should be moderately sized, probably something wrong if not
	if ( colObj->isStaticObject() || ((maxAabb-minAabb).length2() < btScalar(1e12)))
	{
		bp->setAabb(colObj->getBroadphaseHandle(),minAabb,maxAabb, m_dispatcher1);
	} else
	{
		//something went wrong, investigate
		//this assert is unwanted in 3D modelers (danger of loosing work)
		colObj->setActivationState(DISABLE_SIMULATION);

		static bool reportMe = true;
		if (reportMe && m_debugDrawer)
		{
			reportMe = false;
			m_debugDrawer->reportErrorWarning("Overflow in AABB, object removed from simulation");
			m_debugDrawer->reportErrorWarning("If you can reproduce this, please email bugs@continuousphysics.com\n");
			m_debugDrawer->reportErrorWarning("Please include above information, your Platform, version of OS.\n");
			m_debugDrawer->reportErrorWarning("Thanks.\n");
		}
	}
It is static, but must somehow be calculating out to be greater than or equal to that "very large" number, but only sometimes. I put displays in to see if the aabb within my irrlicht code or within bullet was a problem. The ones listed as original and tangent, are my unscaled and scaled mesh within irrlicht, the ones shown as shape and scaled shape are what I get back from bullets collisionShape->getAabb. They look the same and are the same in the instance of the abort. Here are the displays:
original max 182.967636, 30.605700, 380.855377, min -171.433273, -42.644302, -141.466721
tangent max 1829.676392, 306.057007, 3808.553711, min -1714.332764, -426.443024, -1414.667236
shape a -171.433273,-42.644302,-141.466705, b 182.967636,30.605698,380.855377
scaled shape a -1714.332764,-426.442993,-1414.667114, b 1829.676514,306.057007,3808.553711
Debug also shows this error repeatedly from bullet when the above error occurs:
sepAxis=(nan,nan,nan), squaredDistance = nan, shapeTypeA=10,shapeTypeB=1
btGjkPairDetector maxIter exceeded:1002
This comes from btGjkPairDetector.cpp. I was unable to locate the integer values for A and B Shape Types in a way that made any sense. It suggests a box and a capsule. I do have a capsule hidden on the level for later, and the space ship flying toward the level at that point is a box shape, this may be a lead, but I have to presume the culprit is my tri mesh. I couldn't clearly make sense of the enum for shape types.

I'll admit the level is rather large, but it wouldn't seem it would calculate out to the tested length value in the bullet code. Has anyone seen this before or do you have any ideas for debugging it. I'm at a loss.
mi076
Posts: 144
Joined: Fri Aug 01, 2008 6:36 am
Location: Bonn, Germany

Re: aabb box issue with trianglemesh

Post by mi076 »

it might be a harmless issue with uninitialized values... check setup of rigid bodies, may be you have forgotten transform.setIdentity() or something like that...

s. btBroadphaseProxy.h for shape types enum
eagletree
Posts: 28
Joined: Sun Jul 31, 2011 11:20 pm

Re: aabb box issue with trianglemesh

Post by eagletree »

Well if the enum in that h file is correct then it is as I mentioned (but assumed I was wrong). It's my "hidden" capsule of the player character controller and the triangle mesh. Thanks for that, it reinforces to look elsewhere, like at the capsule. Looking for an unset value there would be a new tack.
Aralox
Posts: 2
Joined: Sat Jan 21, 2012 5:58 am

Re: aabb box issue with trianglemesh

Post by Aralox »

Hey eagletree, did you manage to make any progress on this issue?
I just spent a few hours trying to find out why it was happening to me, and just found the answer: I wasnt passing in an inertia tensor to
the RigidBody constructor. I dont know why, but I somehow got the idea that bullet would automatically calculate it for me.
If you still have this problem, my suggestion is that you check every element of the RigidBody constructor carefully.

Good luck :)
Aralox
eagletree
Posts: 28
Joined: Sun Jul 31, 2011 11:20 pm

Re: aabb box issue with trianglemesh

Post by eagletree »

Boy, it's been awhile now, and we had to purchase a commercial engine which only supported PhysX, as the lack of support for the 3D engines (Ogre and Irrlicht) was costing us a couple of weeks for each few lines of code. No hit on bullet because it would be my preference, it ended up working flawlessly for our use, but all we had was good physics.

This is fuzzy, but my problem ended up being the order of creation for the trimesh and the capsule. I reversed the order, and moved the creation of the capsule way forward in the code, and the problem went away permanently. While that sounds like an accident waiting to happen, we progressed through 1000s of executions without failure after that.

Thanks for the info though and hopefully your experience will help someone else.
Aralox
Posts: 2
Joined: Sat Jan 21, 2012 5:58 am

Re: aabb box issue with trianglemesh

Post by Aralox »

Good to know you werent held back by this! Physx is pretty good, I've used it before, but the candy wrapper for c# (and other .net wrappers) were all basically abandoned and unsupported fully by MOGRE, so I gave up on it. In any case, Bullet is now working like a charm for me.

And i will keep that in mind, sometimes the most arcane solutions seem to work :P Ill try doing the trimesh first if I encounter anything weird in the future.

Good luck with future development :)
Aralox

PS: Sorry about the necropost, just realised this thread was a bit older than I thought it was - I guess holidays mess with your sense of time :P
eagletree
Posts: 28
Joined: Sun Jul 31, 2011 11:20 pm

Re: aabb box issue with trianglemesh

Post by eagletree »

Necropost? I would like to see every unanswered post on every game forum answered myself. It's pretty frustrating to run into a brick wall and have all the posts on same issue not have responses.

My solution was arcane for sure, but I suspect (as so many programmers do), I was hammering something in bullet and it was taking the heat. Rearranging things sometimes exposes our own issues, especially with a structure change and rewriting ;). If I'd had some threading involved, my "solution" might make more sense.

Same to you on development success.
Post Reply