Search Unity

Non kinematic, non convex rigidbody collision - A proposed "workaround"?

Discussion in 'Physics' started by ZO5KmUG6R, Apr 4, 2018.

  1. ZO5KmUG6R

    ZO5KmUG6R

    Joined:
    Jul 15, 2010
    Posts:
    490
    Hey there!

    I'm currently loading some files from a game that have convex rigidbody collision. Since it's from a game and I'm just loading it, I can't really modify it or make compound colliders.

    How bad would performance be if I separated every triangle from the collision model, and made it a separate MeshCollider. Atm I see that it's the only solution to this issue in my case.
     
  2. ThisGamesTooCool

    ThisGamesTooCool

    Joined:
    Apr 5, 2018
    Posts:
    28
    Your performance going to go horribly bad. You can just remove his MeshCollider and add one yourselve; if I understand what do you want: what do you refer when you say: "I'm currently loading some files from a game". I think I can't do a lot more here... I hope I've been usefull!
     
  3. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    It would drop the perf like a brick. and probably wouldn't work how you think. For a start, each "triangle" would become a convex mesh with some invisible volume (there is no concave collider type for rigidbody dynamics in Unity). Next, you would not have a tight fitting shape, or a smooth shape. It would just basically be the most wrong thing you could do.

    Far better would be to explain what you are trying to do and let experienced people help you. Unity supports convex colliders when you apply mesh collider and tick convex. Simply pass the mesh to it.
     
  4. ThisGamesTooCool

    ThisGamesTooCool

    Joined:
    Apr 5, 2018
    Posts:
    28
    Yeah, definitely I think Unity need Concave colliders. Unity 2018 could have this feature!
     
    Kerosini likes this.
  5. ZO5KmUG6R

    ZO5KmUG6R

    Joined:
    Jul 15, 2010
    Posts:
    490
    i'm loading files from a game that does not use convex colliders, and I can't modify these files either, or else people who use my app would have to modify them too.

    This game has convex colliders for objects that I need to somehow get working in Unity.

    I'm reading files from a non-Unity game, like a game editor would. So for example, if I make a physics editor/tester, then someone brings it back into the game, it will behave completely wrong because they tested convex physics in Unity, where it would be concave in the original game.
     
  6. ThisGamesTooCool

    ThisGamesTooCool

    Joined:
    Apr 5, 2018
    Posts:
    28
    And Unity don't allows to you to change it?
     
  7. ZO5KmUG6R

    ZO5KmUG6R

    Joined:
    Jul 15, 2010
    Posts:
    490
    Unity doesn't support convex mesh colliders with physics. I need to find some workaround that gets me near the same effect.

    Maybe I could fill the inside of the mesh with spheres or something.
     
  8. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Unity supports convex mesh colliders with physics.



    See the tickbox and mesh fields? Use those. Most Unity car assets do this.

    If you have to dice it you need to use a DCC package to generate more than one convex collider if you require greater detail. Put the rigidbody as parent, not on the individual children. The manual will explain this as a compound collider. Unity intends to perform this step automatically in the future for concave compound shapes (made of multiple convex).

    Read the manual and good luck.
     
  9. ZO5KmUG6R

    ZO5KmUG6R

    Joined:
    Jul 15, 2010
    Posts:
    490
    Sorry, I misspoke, I meant concave.

    UUUUUUUUUUUUUUUUUUUUUUUUUUGH
    Almost 8 years of using Unity and I still come off as completely incompetent because I can't explain literally anything. thanks autism

    Doesn't help that you have to be 2000% correct with what you say on this forum or else people will just blow you off

    ...and if I read the manual it will tell me exactly what I'm experiencing. Unity does not natively support concave mesh colliders. The EXACT PURPOSE of this topic is to find a WORKAROUND. Not "set it to convex" :|
     
    Last edited: Apr 5, 2018
  10. ZO5KmUG6R

    ZO5KmUG6R

    Joined:
    Jul 15, 2010
    Posts:
    490
    I've thought of an acceptable workaround for breakable things at least : I can create sphere colliders at the mesh vertices / center of faces, which will be good enough for what I need.
     
  11. Kerosini

    Kerosini

    Joined:
    Aug 16, 2014
    Posts:
    13
    Have you tried the spheres at the vertices? I had this idea two, but than I tought about problems with the radius of the spheres. If you have two edges that sharing one vertex with extremly different lengths your collider will become extreme unprecise.

    I also tought about to create something like a 3D Scanner with raycasting on the surface of an static collider an create a vertexmap with uniformly distances to there neighbors. And than creating sherecolliders at each vertex.

    There is an asset at the store that is creating concave colliders https://assetstore.unity.com/packages/tools/physics/concave-collider-4596 but it costs 45$ :eek:

    I think it is a big minus to unity that there is no build in solution for concave colliders on dynamic objects.
     
  12. giantkilleroverunity3d

    giantkilleroverunity3d

    Joined:
    Feb 28, 2014
    Posts:
    383
    I have a similar situation: I am creating a bingo machine. In wings I created two spheres, one inside the other and did a boolean cut so I now have spherical shell. I need concave collider on the inside of the shell. This means I need a concave spherical collider or a mesh collider painted inside.
    I dont know what to do.