I'm trying to make an asset that allows me to break down an arbitrary mesh into its convex components. I have it all set up and working well in Houdini. Each part of the mesh has its own group. I've named those groups based on the collision generation keywords found here [www.sidefx.com]. So for example, I have convex_collision_geo_segment_0 and convex_collision_geo_segment_1. My assumption is that this should result in two separate convex mesh colliders on the resultant object in Unity. However, when I import the HDA into Unity, add it to the scene, and give it a mesh, I get this error:
More than 1 collision mesh detected for part name1_0. Only a single collision mesh is supported per part.
I have tried everything I can think of to separate them into parts, but nothing seems to work. No matter what I do, the resultant mesh only has a mesh collider on one of its parts, not all of them.
The plugin only supports 1 collider per mesh so hence the warning. Typically only 1 collider is used per gameobject. Are you trying to break the mesh into convex meshes or colliders? If you just want meshes, the recommended way would be to use object merges (one object merge per convex mesh) or packed primitives (a point with path to each convex mesh) which the plugin will then generate as separate gameobjects with meshes.
Ah okay no wonder. I want to break it into convex colliders ideally. However, maybe a workaround would be to just create two meshes using one of the methods you mentioned and add the mesh colliders to them after the fact in Unity.
When it comes to using object merges as you suggest, I'm not sure I fully understand. If I use one object merge per convex mesh, how would I then export that as one HDA? Let's say, for example, the Convex Decomposition node divides a mesh into 2-4 segments, depending on the Max Concavity. Is there a way to make it so the HDA will automatically split those segments out into separate game objects?
The object merges would have to be created inside geos in a subnet HDA, so you'll need prior knowledge of how many meshes there will be. I was probably wrong to suggest the object merge approach if you need dynamic number of split meshes. I think packed primitives might be the way to go, where you can generate a point dynamically per convex mesh.
Another option is to wait for the next daily build of Houdini for an updated version of the Unity plugin. I just added the option to split geos by groups which is off by default. When turned on, this will automatically create a separate gameobject for each group along with the mesh. The option is available both in Plugin Settings (global) and per asset under the Asset Options UI. Note that this is considered a deprecated feature as its not fully supported, somewhat error prone, but can be useful in simple situations.