Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Rigidbodies vs. non-konvex colliders

Discussion in 'Physics' started by Memoriesin8bit, Nov 14, 2021.

  1. Memoriesin8bit

    Memoriesin8bit

    Joined:
    Feb 20, 2020
    Posts:
    10
    Hey folks,

    I'm still learning Unity so please forgive me if I ask a beginner question here, but I wasn't able to find an "accepted solution" for this case I got in mind and I wonder if I just use the wrong approach.

    I want to play around with physics more, mainly to learn, see where the limits are and so on and I came to a problem that got me stumped.

    As Unity says: non-konvex colliders are only possible with kinematic rigidbodies.

    In a lot of cases, that's not really a problem. Imagine you build a bucket or a trash can - which needs a non-konvex collider so you can fill it with objects. That works.
    But what if you want the player be able to topple over that container? Or carry/throw it? How would you got about doing that? I guess you could build the thing out of many, many little box/capsule colliders, but that can't be the intended solution, right?

    Or let's go a bit more complex: Imagine you want to do a balance game where you gotta haul some freight in your pickup truck and prevent your freight from falling off. You'd have a car which is desirably moved by forces on its rigidbody with a loading area which is most likely non-convex as well (unless I want to use many many box colliders again which I am not sure will got smoothly with the freight it's supposed to hold).

    I am probably missing something really obvious here which is why I hesitated to even make this thread, but I just have to know where my thought process got derailed or what I'm missing.

    Thank you already for your answers. :)
     
  2. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,428
    Well, yes, that's the actual solution. A dynamic rigidbody can use convex colliders only, but it can have any number of them. You can compose non-convex objects out of convex colliders.

    Here's a short guide of the different combinations of rigidbody / collider / trigger, together with example use cases of all them:
    https://forum.unity.com/threads/hel...r-rigidbody-combinations.525258/#post-3452001
     
    Memoriesin8bit likes this.
  3. Memoriesin8bit

    Memoriesin8bit

    Joined:
    Feb 20, 2020
    Posts:
    10
    Thanks Edy!

    I guess I was overthinking the problem quite a bit here. The more I think about this, a lot of cases I can imagine can be solved with some simplified collisions which doesn't just reduce the amount of colliders needed which in turn also prevents issues with collision resolving along the way. At least to a certain degree. Either way this gives me a good handle on how to proceed with my current test project and I won't constantly doubt myself on if I'm even using the correct approach. :)
     
    Edy likes this.