Cleaning the mesh failed?

“cleaning the mesh failed”

“Error in file: TriangleMesh.cpp”

I just got this error with nothing in a scene but the camera and a plane with a large .jpg texture on it.

any advice?

I got this when I had a child-plane of an object that was scaled to zero. I don’t know what could be causing it on your project, though.

1 Like

ok…well its not causing a problem at the moment anyway…just sitting there in its little bar at the bottom taunting me.

I am getting this message when I try to use a mesh collider. Use another type of collider, no error. Any reason for this?

And it’s more than just a “throwaway” error, as might be inferred from above. The collider is not functional at all. I check the mesh…it’s watertight and the normals are all pointing the right way.

Upon further testing, it looks like my problem relates to scaling too. The mesh collider doesn’t want to play nicely with scaling. Why not?

46883--1713--$picture_1_108.png

Sorry for digging up an old thread, but I now do get this message too, since I received a stack of new content from our artists today (unity version 2.02f2).

In my case it is in file TriangleMeshBuilder.cpp, line 363.

Is there any effective way to identify the malfunctioning model / texture / whatever it might be? With effective I mean without testing every single object individually…

It’d be nice if there’d be an indication which object is causing the problem…

Me too.

It started after I added a plane with a texture with an alpha channel. Now it just comes and goes when it feels like it. Restarting Unity sometimes shuts it up for a bit.

I wish I could find out what it’s about. And who’s Joe?

i’m getting the same error for my script that scales back my crater to nothing in my game(that works, you can try it out from www.g3david.tk and click Unity and go to net test=>QuickLink) that i’m using to remove player spawn vehicles, i’m guessing its not liking cleaning up the mesh collider when it scales cause it wants to recalc collision(yet the new collisions work, though i’m scaling uniformly)

I imagine the people in this thread already found the solution, but since it wasn’t posted, I thought I would share what I’ve found.

I had this issue today and found a solution. It has to do with the scale of the GameObject (or parent GameObject(s)) the mesh belongs to at the time you attach a mesh collider component.

In my case, the scale of the x and y components on the parent GameObject were set to 0. After setting them to something > 0, it worked.

8 Likes

Thank you very much for posting that. I never did find out what was causing it it just went away by itself.

I got this error using my “invisible boundary” fence-post code. (See http://forum.unity3d.com/viewtopic.php?p=289823.) Turns out my code made meshes with scale=0 in rare cases. After moving the fence posts apart, so the meshes between them had scale>0, the error went away.

And by the way, the Joe in question is actually Joachim Ante, Unity Tech’s chief technical guru.

I am also using this solution.
change “iTween.ScaleTo(gameObject, Vector3.zero, .8f);” to “iTween.ScaleTo(gameObject, new Vector3(.1f, .1f, .1f), .8f);”

Thank you @jmcclure ! :slight_smile:

I thinks it mainly happens when you add mesh collider to same objects at once . Try to remove mesh collider and add mesh collider on each component one by one

I started having the same problem yesterday

E/Unity: [Physics.PhysX] cleaning the mesh failed
//redacted
[./physx/source/physxcooking/src/mesh/TriangleMeshBuilder.cpp line -1922976100]

I altered my Save() code to include the Drawing() method at the begining // it was needed
By reading this post I noticed that the way I referenced my methods ended up doing this:

I am drawing a procedural mesh, it has collision, a mesh collider.

It enters the Save() method
finish drawing the mesh // called Drawing()
Drawing changes the mesh and send it to the mesh filter
Drawing checks if it has at least 6 triangles (I have it cached, don’t worry)
If it has more than 6 triangles it updates the collision mesh
Drawing finishes it stuff and ends
Back to the Save method, it takes the cached mesh and send it to serialization
The Save method tries to use that mesh to update the collision mesh // that was already here
It updates the material so I can differentiate the saved ones from the currently drawing

The main thing that changed in my code was that I am updating the collision mesh two times in a row, before it can finish the frame or enter the physics update (or FixeUpdate or anything physics related)

Also cooking option was set to everything by default, I have to check it too.

I will go find the real culprit. By the look of the horses, the problem was my multi mesh update

1 Like

It seems that sometimes I was trying to add a mesh collider with an area of zero. It’s not supported.

Here is the doc on MeshCollider

Reading this docs I found the culprit, the degenerate triangles

A lot of problems may appear by having triangles with zero area, or a MeshCollider with zero area, huge area or flipped scale (by altering the game object’s scale to (-1, 1, 1) for an example)

1 Like

Hello.
I’m getting the same error in my AR app. I’m using ARFoundation Meshing system (ARKit scene reonstruction) and in “mesh updating” function I’m getting

Error: [Physics.PhysX] cleaning the mesh failed

Thank you @Niter88 for hints on this issue. I will try to dig into this problem and thanks for your info I know where to start.

1 Like