Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Are Convex Mesh Colliders still limited to 255 verticies?

Discussion in '5.6 Beta' started by sgower, Mar 28, 2017.

  1. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    316
    Hello, I've frequently ran into problems when I try to set non-convex mesh colliders to be non-kinematic. The solution is to change the mesh collider to be convex. But then (at least I used to) have a problem setting some mesh colliders to convex due to too many (over 255) verticies.

    But now, I notice that in 5.6, I'm no longer getting the error message when setting meshes with over 255 verticies to be convex. Did something change? If so, awesome!

    I still wish Unity would allow non-kinematic, non-convex mesh colliders. I understand it's a performance issue correct? I say allow it, and then leave it to devs to understand the performance issues it may cause. The only solution at present is to use the Concave Collider asset from the asset store...which works, but it shouldn't be necessary IMO.
     
    SamFernGamer4k likes this.
  2. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    593
    Hi,

    I believe the 256 vertices requirement should still be there in Unity 5.6, more or less.

    However, we have exposed the inflation option in around 5.5 (https://docs.unity3d.com/ScriptReference/MeshCollider-inflateMesh.html) and that has a great potential to reduce the complexity of the generated convex hulls. Could it be that you were having it checked in the inspector?

    As for the convex hulls in general, the basic idea is that we have two things in the pipeline -- the PhysX update, and V-HACD integration.

    The new PhysX 3.4 has the convex hull generation module completely rewritten from scratch and doesn't suffer from the same accuracy issues as the one in the current versions. There is a high chance PhysX 3.4 will appear in some experimental builds later this year.

    V-HACD (https://github.com/kmammou/v-hacd) is a small nice library to compute the approximate convex decompositions of any meshes. There was an experimental build with it available around mid 2016, but it revealed some additional things had to be done per the beta users feedback, thus it bounced back to the dev queue again. I'm sure something will be made available soon (TM).

    Finally, speaking of arbitrary meshes attached to the dynamic bodies, this isn't a restriction coming from Unity I'm afraid. This is a PhysX thing (http://docs.nvidia.com/gameworks/co...x/guide/Manual/RigidBodyCollision.html#shapes):

    "There are some restrictions on which geometries may be specified for a shape, depending on the shape flags and the type of the parent actors.

    • TriangleMesh, HeightField and Plane geometries are not supported for simulation shapes that are attached to dynamic actors, unless the dynamic actors are configured to be kinematic.
    • TriangleMesh and HeightField geometries are not supported for trigger shapes."
    Hope that helps.

    Anthony
     
    SamFernGamer4k likes this.