Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by art_craft_vlad · Jul 28, 2015 at 09:08 AM · collidermeshphysxconvex

Can I catch "Gu::ConvexMesh::loadConvexHull: convex hull init failed!" error?

We are experimenting with Fracturing and Destruction extension and while working on our model, we are getting this "Gu::ConvexMesh::loadConvexHull: convex hull init failed!" error (see the stack below). I can step into the where the error happens and it is at the line where we are setting convex flag to true.

 MeshCollider cldr = chunk.gameObject.AddComponent<MeshCollider>();
 cldr.convex = true;
 

Ideally, I would like to catch that error with some information on what object it occurs, so I can provide a meaningful message to the content creator. However, there are no return values here obviously and the exception is not thrown.

Does anyone know about any possible solutions or workarounds to the problem?

The full stack:

 Gu::ConvexMesh::loadConvexHull: convex hull init failed! Try to use the PxConvexFlag::eINFLATE_CONVEX flag. (see PxToolkit::createConvexMeshSafe)
 UnityEngine.MeshCollider:set_convex(Boolean)
 UltimateFracturing.Fracturer:ComputeChunkColliders(FracturedObject, ProgressDelegate) (at Assets/Ultimate Game Tools/Fracturing/Scripts/Fracture.cs:1446)
 UltimateFracturing.Fracturer:FractureToChunksBSPMultipleInteriors(FracturedObject, Boolean, List`1&, ProgressDelegate) (at Assets/Destruction Testing/Scripts/FractureAlgorithms.cs:627)
 UltimateFracturing.Fracturer:ACEFracture(FracturedObject, Boolean, List`1&, ProgressDelegate) (at Assets/Destruction Testing/Scripts/FractureAlgorithms.cs:19)
 UltimateFracturing.Fracturer:FractureToChunks(FracturedObject, Boolean, List`1&, ProgressDelegate) (at Assets/Ultimate Game Tools/Fracturing/Scripts/Fracture.cs:196)
 FracturedObjectEditor:ComputeChunks(FracturedObject) (at Assets/Destruction Testing/Scripts/Editor/FracturedInspectorExtension.cs:122)
 FracturedObjectEditor:FixedInspectorGUI() (at Assets/Destruction Testing/Scripts/Editor/FracturedInspectorExtension.cs:514)
 FracturedObjectEditor:OnInspectorGUI() (at Assets/Ultimate Game Tools/Fracturing/Editor/FracturedObjectEditor.cs:335)
 UnityEditor.DockArea:OnGUI()
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image gorsefan · Mar 11, 2016 at 02:58 PM 0
Share

I am looking at 600+ "errors" of this nature in my log (I am procedurally generating a lot of objects and generating lower-poly versions of them for a LoD system).

One "workaround" is; http://docs.unity3d.com/$$anonymous$$anual/class-$$anonymous$$eshCollider.html "Convex: If enabled, this $$anonymous$$esh Collider will collide with other $$anonymous$$esh Colliders. Convex $$anonymous$$esh Colliders are limited to 255 triangles."

This looks like a limitation of Nvidia's Physx middleware https://en.wikipedia.org/wiki/PhysX which is what is actually throwing the error.

But this is not an answer, wrapping convex = true in try/catch blocks etc. does not trap the error. I am a C# newbie but these messages do not appear to be Exceptions which can be caught, they appear to be error messages and I don't know how to suppress them.

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by Bunny83 · Mar 11, 2016 at 03:39 PM

As far as i know you can't "catch" the error since it doesn't seem to be an exception, but a warning / error from native C++ land.

However there are only two reasons why Unity / Physx might fail to initialize the convex hull:

  • The mesh doesn't have any volume. So any flat mesh like a single quad or triangle will cause that error.

  • The mesh is too complex so the 255 triangles aren't enough to construct the convex hull.

Note: In most cases it's reason No1. No2 is quite rare. The convex hull for most meshes has way less triangles than the original mesh. However if the mesh has itself a lot vertices on the convex hull itself this error can happen as well.

So to check No1, just make sure your mesh's triangles don't lay in the same plane. For that you can use Unity's Plane struct. Just use the corners of the first triangle to create a Plane. Now you can simply iterate the remaining vertices and do a distance check with the Plane. You need at least one that has a significant distance from the initial plane so the mesh does have some "depth".

There's no real solution for No2 besides to use a custom convex hull algorithm

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image gorsefan · Mar 12, 2016 at 11:15 AM 0
Share
 if (mesh.triangles.Length > 3)
     meshCollider.convex = true;

Woop there go my errors, super useful, thanks Bunny83

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Re: Maya .FBX and Mesh Collider Issue 0 Answers

Setting Mesh Colliders convex through script 1 Answer

How get mesh from convex mesh collider? 0 Answers

No Convex option to enable on a mesh / "is not a member of 'UnityEngine.Collider'" 0 Answers

Problem with convex Mesh Colliders 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges