what is the tolerance of distance for contact in Bullet?

Post Reply
Xuhai.Tang
Posts: 16
Joined: Wed Feb 23, 2011 4:54 pm

what is the tolerance of distance for contact in Bullet?

Post by Xuhai.Tang »

If the distance between two objects is 0.0, the two objects are contact. But in numerical method there is no perfect 0.0.

So, what is the tolerance of distance in Bullet?

Sorry for my poor English.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: what is the tolerance of distance for contact in Bullet?

Post by Erwin Coumans »

Contact points can be added even if the distance is positive. The constraint solver can deal with contacts with positive distances as well as negative (penetration). Contact points are discarded if the distance exceeds a certain threshold.

Bullet has a contact processing threshold and a contact breaking threshold.
If the distance is larger than the contact breaking threshold, it will be removed after one frame.
If the distance is larger than the contact processing threshold, the constraint solver will ignore it.

This is separate/independent from the collision margin. The collision margin increases the object a bit to improve collision detection performance and accuracy.

Again, thanks for bringing up this complicated topic, unfortunately it is not well documented.
Thanks,
Erwin
Xuhai.Tang
Posts: 16
Joined: Wed Feb 23, 2011 4:54 pm

Re: what is the tolerance of distance for contact in Bullet?

Post by Xuhai.Tang »

Erwin Coumans wrote:Contact points can be added even if the distance is positive. The constraint solver can deal with contacts with positive distances as well as negative (penetration). Contact points are discarded if the distance exceeds a certain threshold.

Bullet has a contact processing threshold and a contact breaking threshold.
If the distance is larger than the contact breaking threshold, it will be removed after one frame.
If the distance is larger than the contact processing threshold, the constraint solver will ignore it.

This is separate/independent from the collision margin. The collision margin increases the object a bit to improve collision detection performance and accuracy.

Again, thanks for bringing up this complicated topic, unfortunately it is not well documented.
Thanks,
Erwin
Erwin, thank you.
I have three more short questions:
(1) How can I read the current value of my object's "collision margin"?
(2) Is the collision margin an absolute or relative number?
(3) Can I edit the value of the collision margin?

Thanks in advance,
Xuhai
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: what is the tolerance of distance for contact in Bullet?

Post by Erwin Coumans »

The collision margin can be set/get by the user using btCollisionShape::getMargin/setMargin

This margin is a absolute value, by default it is 0.04 units for convex objects. Assuming 1 unit = 1 meter, this means 4 centimeter.
The handling of the collision margin differs dependent on the type of collision shape.
Most implicit convex shapes, such as btSphereShape, btBoxShape embed this margin.
The convex hull shape extends the shape with the margin. To compensate for this you can scale the graphics object, or shrink the btConvexHull.
See for example: http://code.google.com/p/bullet/source/ ... mo.cpp#299

Thanks,
Erwin
shadiq
Posts: 5
Joined: Sun Jun 05, 2011 3:56 pm

Re: what is the tolerance of distance for contact in Bullet?

Post by shadiq »

This is really valuable for us.........
Xuhai.Tang
Posts: 16
Joined: Wed Feb 23, 2011 4:54 pm

Re: what is the tolerance of distance for contact in Bullet?

Post by Xuhai.Tang »

Erwin, thank you for your promptly reply.

Xuhai

Erwin Coumans wrote:The collision margin can be set/get by the user using btCollisionShape::getMargin/setMargin

This margin is a absolute value, by default it is 0.04 units for convex objects. Assuming 1 unit = 1 meter, this means 4 centimeter.
The handling of the collision margin differs dependent on the type of collision shape.
Most implicit convex shapes, such as btSphereShape, btBoxShape embed this margin.
The convex hull shape extends the shape with the margin. To compensate for this you can scale the graphics object, or shrink the btConvexHull.
See for example: http://code.google.com/p/bullet/source/ ... mo.cpp#299

Thanks,
Erwin
nictosi
Posts: 11
Joined: Mon Jul 06, 2015 9:25 am

Re: what is the tolerance of distance for contact in Bullet?

Post by nictosi »

Erwin Coumans wrote:Contact points can be added even if the distance is positive. The constraint solver can deal with contacts with positive distances as well as negative (penetration). Contact points are discarded if the distance exceeds a certain threshold.

Bullet has a contact processing threshold and a contact breaking threshold.
If the distance is larger than the contact breaking threshold, it will be removed after one frame.
If the distance is larger than the contact processing threshold, the constraint solver will ignore it.

This is separate/independent from the collision margin. The collision margin increases the object a bit to improve collision detection performance and accuracy.

Again, thanks for bringing up this complicated topic, unfortunately it is not well documented.
Thanks,
Erwin

Thanks a lot Erwin.

If I need to keep at least a minimum distance d between two collision objects, shall I set the breaking threshold to d or rather the margin to d?
Post Reply