Boxes resting on edges

Post Reply
Paul
Posts: 5
Joined: Sun Jun 01, 2008 6:36 pm

Boxes resting on edges

Post by Paul »

Hi. Firstly, love Bullet.

I've noticed in my current program that when I drop boxes onto a ground plane, and they bounce and land exactly on one edge, it seems to take a long time for them to settle over onto a face.

I've tried messing about with various properties of the rigid body, but don't seem to be able to find anything to affect it.

Is there anyway to reduce the time a box spends balanced on one edge before it tips over onto a face?

[EDIT]
An apparent, hackish solution seems to be to create the box shape slightly none-cubic, e.g btBoxShape(btVector3(0.51f,0.5f,0.5f)) instead of 0.5f,0.5f,0.5f but this seems like a bit of a workround rather than a solution.

Paul
User avatar
Erwin Coumans
Site Admin
Posts: 4232
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Boxes resting on edges

Post by Erwin Coumans »

How do you exactly drop them down? Can you reproduce this in the Bullet demos?

Bullet uses a special box-box collision detector, you could try using GJK instead, and see if that improves your situation:

Remove/disable/comment out those lines in Bullet\src\BulletCollision\CollisionDispatch\btDefaultCollisionConfiguration.cpp, around line 237:

Code: Select all

if ((proxyType0 == BOX_SHAPE_PROXYTYPE) && (proxyType1 == BOX_SHAPE_PROXYTYPE))
	{
		return m_boxBoxCF;
	}
	
Hope this helps,
Erwin
Paul
Posts: 5
Joined: Sun Jun 01, 2008 6:36 pm

Re: Boxes resting on edges

Post by Paul »

Thanks very much for the response.

I'm just dropping the boxes from the camera positon, without any rotation. When they hit the floor and bounce, if by chance they happen to land again exactly on one edge, what seems to happen is that it can take longer than the sleeping threshold for the box to decide which way to settle, so they end up stuck on one edge until reawakened by another collision.

When I have time to rebuild the Bullet source, I'll try your suggestion above, although to be honest, making a box shape like btBoxShape(0.5f,0.501f,0.502f) seems to also solve the problem, since I guess it makes the box of slightly different dimensions along each axis which makes it fall onto a side from an edge quicker, without making any visible difference to the simulation.
Post Reply