Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Concave Collider - Generate compound colliders with one click! [RELEASED]

Discussion in 'Assets and Asset Store' started by UGTools, Oct 10, 2012.

  1. StaticWave

    StaticWave

    Joined:
    Aug 21, 2016
    Posts:
    17
    Crashing on 80% of the assets we have tried. anyway i can get some help? i can give the assets or asset in an email or another private avenue?

    Boss telling me to ask for refund =( but i am confident this can be debugged and solved.
     
  2. JamesSen_DS

    JamesSen_DS

    Joined:
    Jan 13, 2016
    Posts:
    12
    By crashing do you mean Unity itself crashes and closes or the asset just seems to hang during generation?

    I've found a couple of options can work for resolving either of these issues.

    1. Try changing algorithm often this can happen using fast but normal will work fine or vice versa.

    2. Drastically reduce the number of hulls generated (i usually drop it to around 10 / 20 ) to confirm that something actually gets generated before increasing again - This also often fixes the hulls will no volumes errors and in cases where it doesn't switching algorithm tends to.

    3. Break your meshes into more groups / sub groups in your preferred modelling package and re-import into Unity. This gives more game objects with smaller, simpler meshes and will make the generation a lot more accurate and stable. The downside to this is of course more objects means more hulls to generate.
     
  3. StaticWave

    StaticWave

    Joined:
    Aug 21, 2016
    Posts:
    17
    Yes Unity itself is crashing.



    I have tried all 3 of the settings this did not seem to help in any of our models that were crashing unity.


    Ive now tried all kinds of different settings on the above object with the same result ending with unity crashing.

    Do you have an any guidelines on when an object needs to be broken into separate pieces, i wouldn't think the above model would be so complex the algorithm couldn't handle it but it appears to be the case with quite a few of the models.
     
  4. JamesSen_DS

    JamesSen_DS

    Joined:
    Jan 13, 2016
    Posts:
    12
    It's hard to give definitive guidelines for doing this as it's really dependent on the mesh and can & will change for almost every asset you attempt to use.

    Luckily breaking meshes down into sub groups is a small task so you're artists shouldn't groan too much when asked to do it :)

    As for breaking down the mesh you only need to go as far as you need for the detail you require. As in this case it simply crashes you will need to break it down enough to at least get the thing working. I would recommend splitting the "arms" off the central ring to begin with and generating the hulls separately for each and breaking down further from there as required.
     
  5. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    Sure it is, but it is a static mesh. I would use Unity's built-in mesh collider for that :)
     
  6. JamesSen_DS

    JamesSen_DS

    Joined:
    Jan 13, 2016
    Posts:
    12
    Hi UGTools,

    Do you have any new / updates regarding the addition of V-HACD?
     
  7. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    424
    Hi! Processing on complex staduim geometry getting stuck ((
     
  8. Chinafreak

    Chinafreak

    Joined:
    Apr 6, 2013
    Posts:
    44
    @UGTools Does this works with RaycastHit triangleIndex (works only on non-convex-mesh-collider)?

    I actually just need concave collider which its static (so without rigidbody), trigger function available and works with triangleIndex from RaycastHit.
     
    Last edited: Apr 2, 2017
  9. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    I have a working version already but I'm still figuring out some parameters and final touches. When I release it it will probably version 2.0 :)
     
  10. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    It works but it would not give you the index of the triangle from the rendered mesh, which is probably what you want. It would give you a triangle index from the collision mesh, which may be any of the sub collision meshes generated by Concave Collider.
    What do you need the triangle index for? Maybe I can help you with that
     
  11. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,114
    Hi @UGTools, does the asset optimizes for mobile phone?
     
  12. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    Yes, there are several settings which let you control the amount of colliders and the number of triangles.
     
  13. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    654
    Hi, new owner here. (though I know @UGTools do good stuff since I've used Fracturing for ages).
    First model I try this on is giving unsatisfactory results with but Fast and Normal algorithm. I've read docs and fiddled with parameters a bit but am obviously missing something. It's a pretty simple model (873 verts, 518 tris from low-poly asset from store) so I'm a bit disappointed.

    Screenshot 2017-05-01 14.51.28.png

    Fast algorithm throws a tonne of errors from PhysX (see below) and generates no mesh unless I turn "Min Hull Volume" right up, after which it just creates a few boxes (still no mesh).

    Failed to create Convex Mesh from source mesh "". Source mesh is likely have too many smooth surface regions. Please reduce the surface smoothness of the source mesh. Alternatively turn on Inflate Mesh and increase the Skin Width sufficiently for this mesh.
    UnityEngine.MeshCollider:set_convex(Boolean)
    ConcaveCollider:ComputeHulls(LogDelegate, ProgressDelegate) (at Assets/Ultimate Game Tools/ConcaveCollider/Scripts/ConcaveCollider.cs:345)
    ConcaveColliderEditor:OnInspectorGUI() (at Assets/Ultimate Game Tools/ConcaveCollider/Editor/ConcaveColliderEditor.cs:138)
    UnityEditor.DockArea:OnGUI()

    [Physics.PhysX] ConvexHullBuilder::CreateTrianglesFromPolygons: convex hull has a polygon with less than 3 vertices!
    UnityEngine.MeshCollider:set_convex(Boolean)
    ConcaveCollider:ComputeHulls(LogDelegate, ProgressDelegate) (at Assets/Ultimate Game Tools/ConcaveCollider/Scripts/ConcaveCollider.cs:345)
    ConcaveColliderEditor:OnInspectorGUI() (at Assets/Ultimate Game Tools/ConcaveCollider/Editor/ConcaveColliderEditor.cs:138)
    UnityEditor.DockArea:OnGUI()

    [Physics.PhysX] Gu::ConvexMesh::loadConvexHull: convex hull init failed! Try to use the PxConvexFlag::eINFLATE_CONVEX flag. (see PxToolkit::createConvexMeshSafe)
    UnityEngine.MeshCollider:set_convex(Boolean)
    ConcaveCollider:ComputeHulls(LogDelegate, ProgressDelegate) (at Assets/Ultimate Game Tools/ConcaveCollider/Scripts/ConcaveCollider.cs:345)
    ConcaveColliderEditor:OnInspectorGUI() (at Assets/Ultimate Game Tools/ConcaveCollider/Editor/ConcaveColliderEditor.cs:138)
    UnityEditor.DockArea:OnGUI()

    Normal algorithm produces collider that is convex in the area I explicitly need it to be concave -- the top (where the player can move).

    Screenshot 2017-05-01 14.54.06.png

    If you have recommendations re. settings or whatever I can try, I'd be most grateful! Alternatively, I can supply the model privately (can't supply here since it's bought).

    Thanks in advance!
     
  14. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    Hello Arkade!

    Sure, send me the model to info@ultimategametools.com and I will have a look at it.
    Is it going to be a dynamic physics-driven object? If not, you should make it static and use Unity's mesh collider instead :)
     
  15. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    654
    Done! Thanks!
    Yes, I plan the train to be moving through the scenery while the player Snowman jumps around on the back avoiding obstacles, etc. That said, the train's movement will likely not be physics so much as scripted (probably tweens). How does that affect things? However I also might want to use it for other things so this still needs fixing. (e.g. if I decide I want them to crash later)

    Thanks, Rupert.
     
  16. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    654
    Actually, this raises an interesting question: What's the best (user friendly) way to generate a custom Collider for a model?

    Screenshot 2017-05-03 10.11.35.png

    The staircase pictured is low-poly but I'd still prefer to make a Collider that makes the railings around the walkways out of boxes, the top walkway a box, the columns 1 box each then the stairs maybe a ramp (another box). Or perhaps a box each. Can one coax Concave Colliders into generating this? Yes, for a static collider. I strongly suspect a default static MeshCollider will result in more physics CPU usage than a few static boxes. Fair?

    Thanks?
     
  17. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    Hi Rupert,

    The top part is a little bit tricky, but with the Legacy algorithm and incrementing the number of steps to 8 or 9 you can get something like this:
    train.png If the train is not going to be physics-driven, I would maybe just try to use a mesh collider to use precise collisions and move it around changing its transform.position / rotation. It may be a better solution just in this case.
     
  18. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    A static mesh collider is super heavily optimized, you can use that for static objects. Sometimes boxes are better not just for optimization purposes but also preventing the user or other objects getting stuck in tricky places.
    If you use the legacy algorithm and set the advanced options->min hull volume to some ridiculously high value (1e30 for example) then you will always get boxes as a result. For example for your train it would be something like this:
    traincubes.png
     
  19. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    654
    I'm not sure I follow this response. You're proposing using a Mesh Collider...
    Do you mean a default concave mesh collider? That fails the 'walk on the top' requirement.
    Or do you mean a *static* mesh collider? Can one move those with impunity? (at least once one has added a Rigidbody)
    Sorry if I'm lacking some knowledge or am being dumb.
     
  20. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    654
    yeah that's kind'a more the idea I'd envisaged. To aid discussion, I just went ahead and took the time to do this one manually:

    Screenshot 2017-05-05 21.00.20.png

    Yes, I would probably do a better job around the wheels but for now I just wanted to show roughly what I meant. Perhaps it's an option for another fitting algorithm? I.e. Primitives mode? It tries to fit the mesh with as few primitives as possible? (up to number in your limit field)

    Possible?
     
  21. yumianhuli1

    yumianhuli1

    Joined:
    Mar 14, 2015
    Posts:
    92
    Hello,I have a question.I made a custom mesh by code,But the custom mesh can not collider with other gameObject.And How can I do that?Thank U!Best regards!
     
  22. mariafigueroa

    mariafigueroa

    Joined:
    Nov 30, 2017
    Posts:
    4
    Hello!

    We are doing a university project, we are creating random stones which have concavity, we are using concave collider to generate collider meshes, but we have the next error:

    upload_2017-11-30_14-13-15.png

    Rutime log:

    upload_2017-11-30_14-20-11.png

    Coud you help us please?
    Many thanks.

    Regards
     
  23. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    Hi there,

    Could you send me a sample mesh to info@ultimategametools.com so I can have a look at it?
    Thanks in advance

     
  24. dornseif

    dornseif

    Joined:
    Aug 25, 2016
    Posts:
    7
    Hi bought your Concave Collider Tool today and have a few questions. I was a little uncertain since none of your demo scenes demonstrated using it with a humanoid model or skinned mesh, but I thought I would try anyway. Right out of the gate a see a couple of hurdles for me.

    1. Using modified Genesis characters I get a mesh that doesn't quite look like the model in size and proportion, in fact if I had to guess its almost like it's using the original base model.

    2. If I try it on models I have modified in Blender then the meshes are rotated. (this is a blender issue really, but thought maybe others here might be facing the same blender issue and someone here as already written a script to fix. I started to modify the script myself but wanted to check here first.

    3. This one is going to make me loose sleep. The hulls created are not weighted to my rig so they don't move with my models animations.

    That's it for now. This has a huge potential for saving tons of time, so hopefully you or someone here can offer some suggestions. Hmm, as I finish writing this I realize I didnt try the other algorithms. :0 I assumed they would not work either. I will give them a try a respond here if they work.

    Thanks, Tom
     
  25. l0cke

    l0cke

    Joined:
    Apr 15, 2012
    Posts:
    438
    This is not proper way how to generate character colliders. There is no reason to use skinned mesh as collider. Use some primitive like cube and attach it to bone (you can move it in same way as for example sword, no riggind needed). In most cases 1 box (or cylinder) is enough for whole character, for games using more complex hitzones you can use more boxes (head, body, arms...).
     
  26. cjbruce

    cjbruce

    Joined:
    Jun 26, 2017
    Posts:
    12
    Thanks for the great asset! We are using it to generate colliders at runtime in our game for our player-built robots, and it works great!

    Two questions:
    1. Has this been tested with the most recent versions of Unity? Preferably 2018.1, but at least 2017.3?

    2. Because we are using it to generate colliders at runtime, users have the options of selecting which collider they want to use. The pre-visualization for the collider works perfectly in both the editor and at runtime for Windows. In Mac OS, the pre-visualization works perfectly in the editor, but at runtime I am getting the magenta "material can't compute" indication:



    Any ideas why the collider visualization might not show up at runtime?
     
  27. Cremator

    Cremator

    Joined:
    Dec 23, 2015
    Posts:
    11
    Hi, If you encounter the issue "DllNotFoundException" as I did, you should consider creating to files in your "plugins" folder, one "x86" the other one "x86_64" and put the "ConvexDecomposition.dll" in both of them and check the respective version based on which folder you put it in, I managed to fix this issue somehow... then if you get the "bug" where you only get 1 cube hull you should go remove the hulls then go to "advanced option" and select "Normalize input Mesh"... if it still does it select the "normal" computing hulls option.

    if your collider get some isolated box colliders here is a script I made that could help :

    Code (CSharp):
    1. [ExecuteInEditMode]
    2. public class MeshCleaner : MonoBehaviour
    3. {
    4.     public int childrenNumber;
    5.     public BoxCollider[] unwantedChildren;
    6.  
    7.     void Start()
    8.     {
    9.         GameObject objet = this.gameObject;
    10.         childrenNumber = objet.transform.childCount;
    11.         unwantedChildren = objet.GetComponentsInChildren<BoxCollider>();
    12.  
    13.         foreach(BoxCollider box in unwantedChildren)
    14.         {
    15.             DestroyImmediate(box.gameObject);
    16.             DestroyImmediate(this);
    17.         }
    18.     }
    19.  
    20.  
    21. }
    hope it helped
     
    Last edited: Jul 4, 2018
  28. SeanBlissett

    SeanBlissett

    Joined:
    Oct 14, 2014
    Posts:
    2
    Is there a way to place the script on a root gameobject and iterate through all the children and add the concave collider to all children with a mesh filter? I am trying to avoid having to hit Compute Hulls on all of the gameobjets with a meshfilter individually.
     
  29. HonKasumi

    HonKasumi

    Joined:
    Apr 25, 2018
    Posts:
    45
    need some help for this error i get DllNotFoundException: ConvexDecompositionDll
     
  30. nanditho

    nanditho

    Joined:
    Jan 10, 2018
    Posts:
    27
    It drive me crazy, everytime i tried to re import the asset of CC, the plugin folder didn't icluded in.

    So, faces error dll not found. So how can i fix it. I think bug of unity

    I have the 1.24 version

    Can you guys help me?
    Thanks
     
  31. Indispace

    Indispace

    Joined:
    Feb 18, 2020
    Posts:
    1
    The collider is not generated. Please tell me how to solve this problem
     

    Attached Files:

  32. Panickal

    Panickal

    Joined:
    Jan 9, 2022
    Posts:
    3
    This costs almost 50 euros? Unity should have this by default. That's crazy.
     
    valentin56610 likes this.
  33. cjbruce

    cjbruce

    Joined:
    Jun 26, 2017
    Posts:
    12
    It appears that with the upgrade to 2020.3 the Concave Collider asset is working fine for Windows, but not for MacOS. Am I doing something wrong? If it isn't currently supported, are there any plans to release a MacOS version for Unity 2020.x?
     
  34. GioVill

    GioVill

    Joined:
    Nov 27, 2015
    Posts:
    1
    Same problem on my MacBook Pro M1, I get the error "DllNotFoundException: ConvexDecompositionDll assembly:<unknown assembly> type:<unknown type> member:(null)". It seems to not be compatible with Apple Silicon, do you have any idea on when a new update will be available to fix the problem?
     
    valentin56610 likes this.