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

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

  1. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    Hello everyone!

    We're pleased to anounce the release of our Concave Collider component.
    The Concave Collider is a component for Unity that enables complex and accurate collisions.
    In Unity mesh to mesh collisions only work if at least one of the meshes is convex. The Concave Collider helps overcoming this limitation by providing a way to automatically compute a set of colliders that can fit any shape; convex or not. And with just one click!

    The Concave Collider also includes 5 sample scenes with 3D models and different use case scenarios:
    • Scene 1: A spaceship comparing the standard collider vs the concave collider
    • Scene 2: An axe model comparing the standard collider vs the concave collider
    • Scene 3: Various gun models comparing the standard collider vs the concave collider
    • Scene 4: A physics scene where spheres fall into two buckets, one using the concave collider and the other one using the standard collider.
    • Scene 5: A physics scene with interconnected rings, also comparing colliders.
    Requirements:
    • Unity3D Pro 3.5 or higher and Windows or Mac. Products shipped will work on any platform.
    • Scenes have been created using Unity 3.5.5f3.

    Here's the component in action. All scenes are included in the package:



    And here are some screenshots. All content is included in the package:

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    Available at the Asset Store: link
    Last edited: Oct 25, 2012
  2. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    Reserved for future updates

    Version 1.1 Released!

    New features:
    • Full native Mac support!
    • New default algorithm that works way faster than before. Now there are 3 algorithms available that hopefully can suit any object.
    • Dynamic prefab instancing support. Now you can make prefabs out of objects having the concave collider and instance them using the editor or at runtime through scripting.
    • A couple of new parameters for even better adjustment.
    Last edited: Oct 25, 2012
  3. dbryson

    dbryson

    Member

    Joined:
    Nov 9, 2009
    Messages:
    244
    Looks like what I need.

    Does it require pro to use it? Or is that just to edit the meshes it creates?

    How well would it work things like rooms that have walls, floor, ceiling, and door?

    Thanks.
  4. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    It needs the pro version only to generate the hulls, because it relies on an external dll to work and plugin support is a pro-only feature. The products you ship though can run on any platform, it's just for the editor :)

    The Concave Collider is useful for dynamic objects. For static objects like walls, floors etc. you can rely on the standard Unity collider.
    Usually you set up the scenario (static elements) with the standard collider and the convex option unchecked, and use the concave collider on the dynamic objects that requiere precise collisions. Sometimes you can just approximate them with the built in primitive colliders (box, spheres, cylinders) but many times like the video shows you can't. This is where our Concave Collider comes in handy :)
  5. SteveJ

    SteveJ

    Member

    Joined:
    Mar 26, 2010
    Messages:
    1,980
    This looks really neat. What sort of performance impact does this have (if any)? For example, with your axe demonstration you run through several hull-levels. Would you reduce the number purely for performance concerns, or is that not the issue?
  6. dbryson

    dbryson

    Member

    Joined:
    Nov 9, 2009
    Messages:
    244
    Thanks. You should add the pro requirement to the page in the asset store. Somebody without pro will probably buy it, otherwise.
  7. bigkahuna

    bigkahuna

    Member

    Joined:
    Apr 30, 2006
    Messages:
    5,420
    How does performance compare to using, for example, a compound collider (group of simple cubes, spheres, etc.)?
  8. maidamedia

    maidamedia

    Member

    Joined:
    Nov 19, 2009
    Messages:
    179
    Can this plugin help in avoiding animated characters cross walls better than other solutions? Thanks
  9. shifty

    shifty

    Member

    Joined:
    Oct 28, 2011
    Messages:
    252
    trying it out now, some input on performance please boss
  10. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    For a single object, performance wouldn't be an issue. The axe demonstration is just to show different outputs playing with the settings.
    But if you use it on a large number of dynamic objects that will interact with each other, it is important to be able to limit the number of generated hulls and also the number of vertices. Especially on mobile platforms, physics can be the bottleneck if you use too many objects with a large number of colliders.

    Yes, we noticed it shortly after sending the package. It has been updated, thanks :)

    It actually works internally as a compound collider, but instead of primitives we generate a compound collider using convex meshes.
    Performance-wise, primitives like cubes, spheres etc will always be faster than arbitrary convex meshes, as collisions against a primitive are internally computed using a single formula. But there are many cases where you can't approximate an object with primitive colliders unless you create a lot of them or you just sacrifice precision (and it it time consuming!).

    No, usually characters use a simple capsule or cylinder collider for collisions against walls. In that case I'd recommend using continuous collision detection (see the "Collision Detection" parameter on the RigidBody component) and/or increasing the RigidBody's solver iteration count through scripting (see http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody.html)
  11. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    The basic rule is, if you are creating a lot of dynamic objects with concave colliders attached, you should play with the settings to use the lowest possible number of hulls and vertices that still generate an acceptable result.
    If you instance dozens of objects with a hundred hulls each, you'll easily have performance issues. In that case maybe just limiting it to say, 5-8-16 each you may still have the same results and have no performance issues at all.
  12. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    Needless to say, we're open to any suggestions and feature requests. Feedback is more than welcome!
  13. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    Here is another example of the Concave Collider with a spaceship.
    From left to right: The spaceship, the same mesh using the standard Unity3D collider and the same mesh using the Concave Collider component.


    [​IMG]


    In this case we've limited the amount of hulls to 16, enough to cope with all the pointy parts, engines and tail. It took us 10 seconds to set this up. Imagine doing this by hand! :)
    If you need accurate collision detection with the scenario, enemies and laser/missile hits, you can't just rely on a single hull. Concave Collider FTW!
    Last edited: Oct 15, 2012
  14. Thinksquirrel

    Thinksquirrel

    Member

    Joined:
    Feb 8, 2011
    Messages:
    904
    Great tool!

    Any chance of Mac editor support with the native dll? Would love to not have to switch over to Windows to make some colliders. I'd be happy to test this if you'd like.
  15. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    Yes, if there is demand we'll definetly try to add Mac support through a native plugin. I'll keep you posted.
  16. Quickfingers

    Quickfingers

    Member

    Joined:
    Aug 29, 2009
    Messages:
    230
    mac support would be appreciated :)
  17. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    As soon as we get access to a Mac with a proper development environment we'll try to make it happen then :)
  18. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    It seems between tomorrow and the day after tomorrow we'll have a chance to compile a native mac plugin. The code is very platform independent, hopefully we can have some good news!
  19. angel_m

    angel_m

    Member

    Joined:
    Nov 4, 2005
    Messages:
    870
    How do you limit the number of hulls and vertices? Are they set in the Inspector?
  20. kenshin

    kenshin

    Member

    Joined:
    Apr 21, 2010
    Messages:
    687
    Great tool!
    I'll buy soon.
  21. Thinksquirrel

    Thinksquirrel

    Member

    Joined:
    Feb 8, 2011
    Messages:
    904
    Sounds wonderful!
  22. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    Yes, here you can find the component's help: Concave Collider help.
    The first 2 parameters are the ones that allow limiting hulls and vertices.

    The component panel fully expanded looks like this (you will be using the first two parameters and the "compute hulls" button most of the time, though):

    [​IMG]
  23. commodore

    commodore

    Member

    Joined:
    May 30, 2012
    Messages:
    11
    As soon as you have a Mac version ready I'm buying this
  24. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    If somebody that has the Concave Collider and a Mac wants to try the .bundle for Mac, testing is more than welcome.
    We managed to build a Mac version of the plugin (.dll on windows, .bundle on mac), but since the Mac didn't have a Unity Pro license we couldn't see if it worked properly.
    In any case, even if some fixing is necessary, my guess is next week we'll be able to upload a new multiplatform version to the asset store.
  25. Thinksquirrel

    Thinksquirrel

    Member

    Joined:
    Feb 8, 2011
    Messages:
    904
    I'd be happy to test it out on a Mac here.
  26. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    Nice! send me an e-mail to info@ultimategametools.com and I'll send you the .bundle back
  27. commodore

    commodore

    Member

    Joined:
    May 30, 2012
    Messages:
    11
    Unless I'm doing something wrong which is super possible, I couldn't get the Mac version working. I was taking a look at the example projects and when I try to copy/paste the objects the collider goes away. Meaning you can't instantiate the objects into the scene during the game :(
    Last edited: Oct 21, 2012
  28. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    I managed to build a working Mac port today, some previews have been sent out for testing. Fingers crossed!
    We've also made the instancing work, so besides using copy/paste you also will be able to compute the hulls for one object, make a prefab out of it and instance it at will using the editor or through scripts at runtime.

    If the Mac testing goes well my guess is in a couple of days we can upload a new version to the asset store. Let's see how it goes.
  29. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    Hello guys,

    Good news! the Concave Collider version 1.1 has been approved and is now available at the Asset Store.

    New features:

    • Full native Mac support!
    • New default algorithm that works way faster than before. Now there are 3 algorithms available that hopefully can suit any object.
    • Dynamic prefab instancing support. Now you can make prefabs out of objects having the concave collider and instance them using the editor or at runtime through scripting.
    • A couple of new parameters for even better adjustment.

    Note:
    To get the same result as in 1.0, just change the Algorithm to "normal" and set the new Internal Scale parameter to zero.
    All new parameters are described in the .txt included in the package (changelog section). The documentation on the website will be updated ASAP.
    Last edited: Oct 25, 2012
  30. xandeck

    xandeck

    Member

    Joined:
    Apr 2, 2009
    Messages:
    553
    Hello, I dont know if I miss somewhere, but do you have any webversion with lots of objects in scene so we can check it out?
    Your solution looks really like what I need (specially because of meshs) and I need to be sure of performance and how the collision is resolved. Can you provide a web test where we can have that spaceship with your collider and play it around (Instance and Destroy, simple things).

    Thanks
  31. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    We don't have any web tests available, but if you send me an object to test I can send you back a set of different colliders with varying precision tunings for you to play with.
    Just drop me a mail to info@ultimategametools.com if you're interested
  32. SevenBits

    SevenBits

    Member

    Joined:
    Dec 26, 2011
    Messages:
    1,956
    This is quite cool, and a great efficiency tool as well!
  33. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    Thanks!

    Any reviews on the Asset Store would be more than welcome. That would help a lot :)
  34. xandeck

    xandeck

    Member

    Joined:
    Apr 2, 2009
    Messages:
    553
    Ok, I will send you later. Thank you.
    But any special reasons for not having a web version?
  35. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    Basically because it is a component you use when authoring in Unity. On a webplayer/downloadable demo the only thing we can show is how objects interact at runtime, but the interesting part which is the collider creation and setup is unavailable since it is done using Unity itself.
  36. wccrawford

    wccrawford

    Member

    Joined:
    Sep 30, 2011
    Messages:
    1,671
    Is there any advantage to this over using the built-in colliders when it comes to things that don't need to be marked convex, such as floors, walls, etc?

    Are there any restrictions against using this? Such as, can I:

    Create colliders for the objects and then sell the object with colliders? Give the object and colliders away? Create colliders for other peoples' freely available objects, and then give those away?

    Create colliders for other people on demand for profit?

    Use it to create colliders for objects in a group project, where nobody else has bought the plugin?

    Anything else I didn't think of?
  37. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    No, for all static objects using the built-in mesh collider is always the best option since it is a single collider using the original mesh. Nothing can beat that :)

    Some of these are very good points, we'll definetly update the included info file with a section regarding this. Thanks for bringing it up.

    • Create colliders for objects you create and then sell the objects including the colliders: Yes, as long as you are the original author.
    • Give the object and colliders away: Yes, as long as you are the original author and you decide to release it for free.
    • Create colliders for other peoples' freely available objects, and then give those away: No, the restriction is you need to be the original author of the object.
    • Create colliders for other people on demand for profit? No, you may use it of course to make profit out of projects you create, but not based on making profit out of making colliders on demand.
    • Use it to create colliders for objects in a group project, where nobody else has bought the plugin: Yes, as long as it remains on that single computer. Only the computers that bought the license can create the colliders, but they can share them to the rest.
    Last edited: Nov 8, 2012
  38. Thinksquirrel

    Thinksquirrel

    Member

    Joined:
    Feb 8, 2011
    Messages:
    904
    Hey, just wanted to report a very slight issue - the current version on the Asset Store runs into some compile errors upon building the web player (and likely other platforms) due to looking for the UnityEditor namespace. I fixed it by wrapping everything to do with the "Save Mesh Assets" option in #if UNITY_EDITOR defines.

    This is a great tool. It saves an unimaginable amount of time, and the performance is completely dependent on the amount of colliders you make with absolutely 0 overhead (it doesn't run at play mode), which is highly configurable.
  39. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    Thanks for the heads up! I'll send an update ASAP

    Ha! now that's something that would be great as a review at the Asset Store ;)
  40. Thinksquirrel

    Thinksquirrel

    Member

    Joined:
    Feb 8, 2011
    Messages:
    904
    No problem - and already done =)
  41. xandeck

    xandeck

    Member

    Joined:
    Apr 2, 2009
    Messages:
    553
    So, Thinksquirrel, do you aprove the performance? How many objects with these colliders aplying physics are you running in screen?
    I will be direct, UGTools: I have a prototype that needs to be finished soon, it uses physics interaction from player to objects (like get a woodbox, or a chair, or a ladder, all in hands)... like in Half-Life 2 to be simple... I already have this done, but I'm using built-in colliders and mesh convex when needed. But this sometimes act strangelly. I need a better collider option :)
  42. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    What do you mean by strangely?
  43. brewerSharptooth

    brewerSharptooth

    New Member

    Joined:
    Aug 29, 2012
    Messages:
    8
    This looks like a great tool. would this work on a skateboard quarter pipe or a swimming pool?
  44. DCalabrese

    DCalabrese

    Member

    Joined:
    Dec 13, 2011
    Messages:
    227
    This is a great tool - very effective!
    We're trying to add a bowl-like shape into a game using this tool, and it seems to be doing some weird things. I'm wondering if there are good-practices in creating our meshes that we may not be following, or if there are particular settings for the collision generation that we aren't using properly. Check out this image of the original mesh:

    [​IMG]

    And of the collision setup the tool created:
    [​IMG]

    Obviously that doesn't look quite right, as there are a lot of colliders going through the bowl itself - some even capping the top of it. I've isolated one of the meshes so you can see exactly how some of them are being erroneously created:
    [​IMG]

    Could you please give us some pointers on what may be going wrong here, and what we can do to make this work correctly?

    Thank you in advance!
    Last edited: Nov 8, 2012
  45. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    Unless you _really_ need the quarter pipe to be dynamic (i.e. moving around and maybe get tipped over), I'd definetly use the standard static object setup which is attaching a mesh collider component and not enabling the convex option. This creates the most accurate collider since internally the physics engine will use the object's mesh. The same thing goes for the swimming pool.

    The tool is more intended for dynamic objects with rigidbodies attached that need more accurate collisions than primitives or a single convex mesh collider provide.
  46. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    Thanks for the support!
    Every object is different. In my case I usually first try to see which algorithm seems to work better and then which Internal Scale (0 for disabled or > 0 for an actual internal scale value) gives the best results. The back face distance parameter helps in some cases of problematic objects and the precision parameter also allows finetuning in case the legacy algorithm is selected.
    From there usually it's all about optimizing and finding the lowest possible hull vertices and max hulls that still generate acceptable results.

    Your object seems to be a scenario, is that the case? For scenarios or static objects in general it's almost mandatory to use the Unity mesh collider without the convex option since it has all the benefits (speed and precision basically) and no downsides.
    Static objects allow the physics engine to precalc data to speed up collision detection, and enables to use the mesh as the actual collider which means 100% precision.

    If you still need it because the object is dynamic, just mail me the .fbx and I'll give it a look :)
  47. DCalabrese

    DCalabrese

    Member

    Joined:
    Dec 13, 2011
    Messages:
    227
    UGTools, thank you for the fast response!

    We actually spent quite a while trying to use the default mesh collider in Unity, however regardless of what we did we kept finding many scenarios where our vehicle (a skateboard) would go through the mesh. I concluded it was because we kept having concave collision meshes, and breaking the mesh down into a large number of individual collision meshes seemed to fix the problem - but was also very time consuming. That's where we were hoping your solution would come into play.

    What we're actually trying to build is a skatepark, and felt the most efficient way for collisions and construction would be to break down the entire park into sections and focus on those one at a time.

    Just now, I've tried setting the bowl mesh object to be static, to have standard Unity mesh collider, and also set it to have smooth mesh collisions. It SEEMS to be working good so far, but not entirely sure if this will last (as we had similar experiments in the past work at first then break down). If you want to take a look at the mesh and see if we can get it to work with your system, that could still be beneficial in case we do find we have to go with a different solution than Unity's default.
  48. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    I'd go for the static option and use the tool for dynamic objects where precision is required.

    If your skateboard goes through a mesh it's most probably because the physics system computes two time steps with enough distance between each other that the skateboard goes entirely inside/through an object.

    There's three fast solutions you can try:
    -Increase the global "solver iteration count" value in Edit->Project Settings->Physics. This may work but also increases the overall cpu usage for physics.
    -Increase the "solver iteration count" of the skateboard's rigidbody through scripting (help).
    Basically skateboard.rigidbody.solverIterationCount = newValue;
    This is probably what I would do since you only increase the physics solver precision for that particular object, and not every single one.
    -Change the "Collision Detection" property of the skateboard's rigidbody on the component panel to either Continuous or Continuous Dynamic. This probably will keep it from penetrating, but I guess will introduce weird behaviour when riding on ramps and round surfaces. This works best for objects that need to collide abruptly.
  49. UGTools

    UGTools

    Member

    Joined:
    Oct 10, 2012
    Messages:
    392
    By the way I didn't answer your question regarding breaking your object down into individual convex collision meshes.

    As I said, the best option (only option in my humble opinion) for static objects no matter what project, object shape etc is always using the Unity mesh collider without the convex option. Both precision-wise and speed-wise.
    But let's say you want to break it into individual convex meshes for whatever reason.
    If you look at the bowl part, it's so curvy that you would need hundreds of objects surrounding it to fit it properly, hundreds because each one has the limitation that it needs to be convex. Basically you'd end up with tons of trapezoidal objects surrounding each individual triangle/quad of the bowl's center, because you don't want to loose the smoothness.

    Luckily static objects can use the object's mesh as a collider, and don't need a convex collider or group of colliders to have collisions.
    Dynamic objects do have that limitation, that's where our tool comes in handy :)
  50. xandeck

    xandeck

    Member

    Joined:
    Apr 2, 2009
    Messages:
    553
    Hey UGTools,
    What I mean is I had the same problem as DCalabrese, sometimes the objects can pass through the mesh...