How to set the collision check distance?

Typically: "How do I... ", "How can I... " questions
Post Reply
Hacher
Posts: 40
Joined: 28 Nov 2024, 02:00

How to set the collision check distance?

Post by Hacher »

Function sim.checkCollision can only define the entitles you want to check, but it has no parameters to set the minimal distance between two entitles that should be considered as collision. Is there any way to define the minimal distance that should be considered as collision? Because some times I want to consider the mini scale of collision as no collision.
coppelia
Site Admin
Posts: 10802
Joined: 14 Dec 2012, 00:25

Re: How to set the collision check distance?

Post by coppelia »

look at sim.checkDistance instead!

Cheers
Hacher
Posts: 40
Joined: 28 Nov 2024, 02:00

Re: How to set the collision check distance?

Post by Hacher »

Thank you very much for your reply. And is there a way to quantify the degree of interference between two objects? Because here I want to ignore small interferences caused by model inaccuracies.
coppelia
Site Admin
Posts: 10802
Joined: 14 Dec 2012, 00:25

Re: How to set the collision check distance?

Post by coppelia »

Penetration depth cannot directly be detected. What you can do however is start with a schrunk shape (shrinking a shape is somewhat difficult, you'll probably need a special type of app for that). Normally one would start with the original shape and grow it by x mm:
  • select the shape
  • Navigate to [Menu bar > Modules > Geometry / Mesh > Convex hull...]
  • Adjust Growth parameter
  • Click Generate
Then you could hide the generates shape, first check for collision with that shape, and if it collides, additionally check collision/distance with the original shape. Then you could have a good knowledge about the penetration depth (in relation to the grwon shape)

Cheers
Hacher
Posts: 40
Joined: 28 Nov 2024, 02:00

Re: How to set the collision check distance?

Post by Hacher »

Thank you for reply, I notice that the minimum distance in pybullet can be negative value when objects are collideing through the function p.getClosestPoints, considering that the bullet is used in the coppeliasim, is there any way to directly get this value?
coppelia
Site Admin
Posts: 10802
Joined: 14 Dec 2012, 00:25

Re: How to set the collision check distance?

Post by coppelia »

No, you can't. Also, that value would only make sense when you have two convex shapes colliding. If they are not convex the penetration depth could only be approximate.

Cheers
Post Reply