Bent – sorry for the (very) late reply. I can confirm that there is an issue 
with collision detection of non-convex trimeshes.  Looking at the results, I 
suspect a bug in edge-edge collision. But I did not write this part of the code 
and have never looked at it very closely.  The reason things appear to work 
fine for the original track-shoe meshes in 
demo_MBS_collision_trimesh<https://github.com/projectchrono/chrono/blob/main/src/demos/mbs/demo_MBS_collision_trimesh.cpp>
 is that these are relatively fine meshes and so collision pairs get generated 
between many features of these meshes.  When switching to box meshes, any issue 
in a particular type of pairwise feature interaction will result in obvious 
errors. By the way, I pushed a modification of that demo that allows switching 
between the two types of meshes and control other setting s to help identify 
such problems.  If I get some time, I will chase down this bug; or hopefully 
someone else gets to it before me.

Antoine – having said all that, for your particular problem with gears, I would 
still try to leverage collision between convex shapes as that is a much more 
robust algorithm.  Instead of providing the entire gear mesh as one collision 
shape for a gear body, it would be much better (for robustness, but also 
computational efficiency) to create a model for the collision shape of a single 
tooth (that is a convex mesh) and then replicate that as many times as 
necessary in the collision model associated with the gear body.  Look at the 
function CreateLuggedGeometry() in 
demo_VEH_SCMTerrain_WheeledVehicle<https://github.com/projectchrono/chrono/blob/main/src/demos/vehicle/terrain/demo_VEH_SCMTerrain_WheeledVehicle.cpp>
 for an example of generating a (non-convex) collision model by assembling 
multiple instances of the same (convex) mesh and using convex hull collision 
shapes for each of these parts.

--Radu

From: [email protected] <[email protected]> On Behalf 
Of Bent Møller
Sent: Friday, October 17, 2025 12:03 PM
To: ProjectChrono <[email protected]>
Subject: [chrono] Re: Follow-up non-realistic mesh collision

I posted an issue on the github page for chrono a long time ago (no answers 
except for my own workaround) and this might be what is giving you problems 
here. From what I've observed, collisions with even very simple meshes (when 
not marked as being convex) just doesn't work as it should:

https://github.com/projectchrono/chrono/issues/541<https://urldefense.com/v3/__https:/github.com/projectchrono/chrono/issues/541__;!!Mak6IKo!KuyuvRyqqspLqfxSdNzhewqo_6YVGBo3gnL04Hs4R0ntLiDzNhEUonRsKarN4qnXBGbdlsoUscKVvH9xsBQZ$>

I'm not sure what to do except for creating convex hulls from the input-mesh. 
It seems that then the collision-checking ends up using a different approach 
which seems to work.
fredag den 17. oktober 2025 kl. 11.51.17 UTC+2 skrev 
[email protected]<mailto:[email protected]>:
Dear all,

This is a follow-up to the discussion I opened on the 1st of october called 
"Contact detection on mesh objects". By setting up the radius parameter of 
ChCollisionShapeTriangleMesh to a non zero value, some contacts between meshes 
were detected, but many contacts are not detected and the meshes continue to go 
through each others. I added a video to show what is happening concretely.

The two gears are controlled by a motor links, controlled by speed, that go in 
opposite directions so that the gears collide. For information, to get the .stl 
files, I open an assembly file in FreeCAD, select a part and export it in .stl 
format.

Here is what I tried:

- Subdivide the mesh to create more triangles. The idea was that by adding more 
triangles, the chance of detecting a contact would increase. But it changed 
nothing
-  Tune the radius, envelope and margin parameters but I didn't find a 
combination that solves all the problems
- Saved the mesh object in STL and OBJ formats but none of the two brought 
better results
- In the code attached bellow, there is a scaling in load_stl_mesh so that 
everything is in mm, I tried to remove it, but it did not help
- Let the second gear rotate freely using a revolut joint instead of a motor 
link, but it did not help

I am stuck in my learning of pychrono and rigid body collision and any help 
would be greatly appreciated ! I put the code bellow but unfortunately, I can't 
send you the .stl files.

PS: I won't be available next week but I wanted to ask for help before being 
unjoinable
--
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion visit 
https://groups.google.com/d/msgid/projectchrono/10cc7f1a-18d8-46aa-a421-a844f277d60cn%40googlegroups.com<https://urldefense.com/v3/__https:/groups.google.com/d/msgid/projectchrono/10cc7f1a-18d8-46aa-a421-a844f277d60cn*40googlegroups.com?utm_medium=email&utm_source=footer__;JQ!!Mak6IKo!KuyuvRyqqspLqfxSdNzhewqo_6YVGBo3gnL04Hs4R0ntLiDzNhEUonRsKarN4qnXBGbdlsoUscKVvBu3rlOk$>.

-- 
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/projectchrono/CH3PPF46CDC2185D8B83C671E44A163D4C5A7F2A%40CH3PPF46CDC2185.namprd06.prod.outlook.com.

Reply via email to