Hi Page, The issues I was referring to are related to misuse of a connected triangular mesh. What you created is a “triangle soup” with no connectivity information. That is not the best way of specifying a collision mesh. You should read more carefully the description of a ChTriangleMeshConnected and generate all its information. But even better is to use a mesh specified in a Wavefront OBJ file and let Chrono read it and create the corresponding collision object. There are only very few situations where one would need to create a trimesh programmatically. Not knowing what exactly your end goal is, other issues with the code you provided could be: using a trimesh when a convex hull would do (more efficient collision shape) and not sharing the geometry (assuming you have multiple objects/bodies with the same collision shapes.
--Radu From: 'Page' via ProjectChrono <[email protected]> Sent: Saturday, December 2, 2023 8:20 AM To: ProjectChrono <[email protected]> Subject: Re: [chrono] The collision is strange after using AddTriangleMesh Hi,Radu Thank you very much for your prompt reply. The issue you pointed out is correct: I made a mistake in the direction of the normal. When I corrected this issue, it seems to work properly. In this demo, I just tested using a triangular mesh for collisions, and in the future, I will use complex models for precise collisions You mentioned that there are many issues with my code, can you help me point them out? Thank you very much. I am very interested in this physics engine --Page 在2023年11月30日星期四 UTC+8 16:02:20<Radu Serban> 写道: Page, First of all, please attach code as a text file, not a Word document! There are many issues with the code you provided and it’s not clear to me why you are trying such a low-level approach when other solutions are available. If you are convinced you need to create a ChTriangleMeshConnected programmatically (hopefully for something other than a box), please first make sure you understand well how those work and how they should be created. Having said that, one problem with your code is that you define the mesh with normal pointing inwards. The order of the vertices in each triangle follows the right-hand rule. --Radu From: 'Page' via ProjectChrono <[email protected]> Sent: Wednesday, November 29, 2023 10:03 AM To: ProjectChrono <[email protected]> Subject: [chrono] The collision is strange after using AddTriangleMesh Hi,all I write a simple demo, I built a ChBody, use AddTriangleMesh, add a cube mesh, so that two cubes do collision, but the collision effect is obviously wrong, I hope someone can help me, the following is the code and demonstration video -- 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 on the web visit https://groups.google.com/d/msgid/projectchrono/e35df334-7e57-4030-9a14-38c6a60e37a7n%40googlegroups.com<https://groups.google.com/d/msgid/projectchrono/e35df334-7e57-4030-9a14-38c6a60e37a7n%40googlegroups.com?utm_medium=email&utm_source=footer>. -- 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 on the web visit https://groups.google.com/d/msgid/projectchrono/24ec914c-38e7-421f-822a-7a7b7e0c83ban%40googlegroups.com<https://groups.google.com/d/msgid/projectchrono/24ec914c-38e7-421f-822a-7a7b7e0c83ban%40googlegroups.com?utm_medium=email&utm_source=footer>. -- 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 on the web visit https://groups.google.com/d/msgid/projectchrono/PH0PR06MB82374A4951DFB9499D34FD5FA787A%40PH0PR06MB8237.namprd06.prod.outlook.com.
