unity-fracture icon indicating copy to clipboard operation
unity-fracture copied to clipboard

Using Custom Mesh

Open mitoand9 opened this issue 5 years ago • 8 comments

Hi,

I am trying to adapt the code to use my own custom mesh with NvBlast. I imported in Unity a mesh made with an external 3D modelling package and then I fed it to the CreateWall object in the scene (basically my own mesh is fed as the cubeMesh in the script). Unfortunately Unity crashes. On the other hand, if I try to feed one of Unity's built-in meshes (cube, sphere, capsule..), everything works fine.

After debugging for a while I realised that the crash occurs when the Fracture object calls setSourceMesh(nvMesh), so exactly inside the Bake method.

Any idea what is preventing my own meshes from working?

Thanks in advance

mitoand9 avatar Apr 10 '20 11:04 mitoand9

Hi no idea, I remember I had problem with meshes with holes or disconnected vertices (faces did not share vertices)

On Fri, 10 Apr 2020 at 13:53, mitoand9 [email protected] wrote:

Hi,

I am trying to adapt the code to use my own custom mesh with NvBlast. I imported in Unity a mesh made with an external 3D modelling package and then I fed it to the CreateWall object in the scene (basically my own mesh is fed as the cubeMesh in the script). Unfortunately Unity crashes. On the other hand, if I try to feed one of Unity's built-in meshes (cube, sphere, capsule..), everything works fine.

After debugging for a while I realised that the crash occurs when the Fracture object calls setSourceMesh(nvMesh), so exactly inside the Bake method.

Any idea what is preventing my own meshes from working?

Thanks in advance

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ElasticSea/Destructible-Walls/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI2G5AIM777LNZVAH6354DDRL4CDZANCNFSM4MFM4VFA .

ElasticSea avatar Apr 10 '20 16:04 ElasticSea

Thanks for the feedback. So I noticed that any mesh built in Unity works fine, even those with holes inside them (I made a few with ProBuilder). However, when it comes to any FBX made outside Unity, it won't work. For my project, ProBuilder is all I need, so I am happy. But for more complex shapes it currently does not work.

mitoand9 avatar Apr 11 '20 09:04 mitoand9

Could you attach a simple .fbx model that I could take a look at?

ElasticSea avatar Apr 11 '20 10:04 ElasticSea

WallWindow.zip

Here you go. It's just a simple wall with a hole inside, mesh should be airtight. I also tried with a simple cube made in Blender, the default one.. that also does not work,

mitoand9 avatar Apr 11 '20 10:04 mitoand9

So I just quickly assigned your mesh to the cubemesh field at CreateWalls:32 and it works as expected. I just changed the import scale factor to 50.

ElasticSea avatar Apr 18 '20 17:04 ElasticSea

Mmn okay strange. Not sure why scale would be have to be changed. Could be a Unity version issue..? 2019.3.0f3

mitoand9 avatar Apr 18 '20 18:04 mitoand9

No issue in 2019.3.0f1. You could send me the whole project and I could take a look.

ElasticSea avatar Apr 18 '20 21:04 ElasticSea

Ok, I'll try to isolate the issue in a single scene and send it through because it's quite a big project. Thanks for that!

I also have another question, but this is about batching of each chunk. I'll open a new thread for that.

mitoand9 avatar Apr 19 '20 20:04 mitoand9