btSettings

DevO
Posts: 95
Joined: Fri Mar 31, 2006 7:13 pm

btSettings

Post by DevO »

Box2D has b2Settings header file where you can tweak all the settings for the engine.
This wold be great if Bullet would be have such file.
Where all this hard coded limits like gContactBreakingThreshold, "epsilons" like btScalar(0.0001) could be tweaked.

I think "epsilon" like 0.0001 is not really well on both single and double precession , or I am wrong with this?

Code: Select all

// Dynamics
const float32 b2_linearSlop = 0.005f * b2_lengthUnitsPerMeter;	// 0.5 cm
const float32 b2_angularSlop = 2.0f / 180.0f * b2_pi;			// 2 degrees
const float32 b2_velocityThreshold = 1.0f * b2_lengthUnitsPerMeter / b2_timeUnitsPerSecond;		// 1 m/s
const float32 b2_maxLinearCorrection = 0.2f * b2_lengthUnitsPerMeter;	// 20 cm
const float32 b2_maxAngularCorrection = 8.0f / 180.0f * b2_pi;			// 8 degrees
const float32 b2_contactBaumgarte = 0.2f;

// Sleep
const float32 b2_timeToSleep = 0.5f * b2_timeUnitsPerSecond;	// half a second
const float32 b2_linearSleepTolerance = 0.01f * b2_lengthUnitsPerMeter / b2_timeUnitsPerSecond;	// 1 cm/s
const float32 b2_angularSleepTolerance = 0.5f / 180.0f / b2_timeUnitsPerSecond;		
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: btSettings

Post by Erwin Coumans »

Good idea. Yeah, it would be convenient, but it is not recommended to change most settings by end users.

There would be at least 2 sets of settings, btCollisionSettings and btDynamicsSettings, because in Bullet those systems are separate: you can use the collision detection without the dynamics.

Warning: most of the epsilons and other values need a very long description.

Hope this helps,
Erwin
DevO
Posts: 95
Joined: Fri Mar 31, 2006 7:13 pm

Re: btSettings

Post by DevO »

Good idea. Yeah, it would be convenient, but it is not recommended to change most settings by end users.
We are talking not about end user but about programmer why may be want to tweak Bullet for his own purpose, like me :)

Here are 4 files that demonstrating how this could be done?

I have just added epsilon for
btConvexShapes::localGetSupportingVertexWithoutMargin().

Epsilons need to be different for single or double floats or I am wrong about this???
You do not have the required permissions to view the files attached to this post.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: btSettings

Post by Erwin Coumans »

Thanks, I will look into it.

I probably stick with just the header file, not the .cpp file, so leaving the variables in the original place. To avoids introducing dependencies to the btCollisionSettings file, the internal SDK won't need to included it.

Erwin
DevO
Posts: 95
Joined: Fri Mar 31, 2006 7:13 pm

Re: btSettings

Post by DevO »

Well yes only header file are probably better.

What is now about Epsilon values?
Do you think that we need different epsilons for single and double floats?

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

Re: btSettings

Post by Erwin Coumans »

We need to carefully check this on a case-by-case basis, not a global find and replace of course. Ideally, most epsilons use the predefined constant from LinearMath/btScalar.h:

SIMD_EPSILON
This is defined with different precision when double precision (BT_USE_DOUBLE_PRECISION) is used.

Unless there are good reasons, we should probably just stick with this SIMD_EPSILON in most cases. Note that it is better to use scaled epsilons. However also this is a more subtle. For example, in Bullet GJK, the collision checks are done in relative space (in the middle of both objects) to improve accuracy.

Another cleanup would be to replace all the hardcoded 1e30 by SIMD_INFINITY. Then the SIMD_EPSILON should be rename BT_EPSILON for more consistent naming conventions.

Do you have a specific file/line number of an epsilon that concerns you?
Thanks,
Erwin