Closed Jan1902 closed 5 years ago
can you post the file you are trying to load?
https://www.file-upload.net/download-13415556/MainSceneExportedNavMesh.obj.html
Sure, here it is. Might be broken, but at least in the editor it looks fine to me.
Just tried a different model, and it worked just fine so it is most likely some problem with the model I was using previously. Probably because it is a NavMesh exported from Unity using a simple script. It might contain something that throws g3sharp off.
Whatever software you exported from, exported with commas instead of periods as the decimal separator:
g ExportedNavMesh v -49,33333 0,08333334 -42,66667 v -42,66667 0,08333334 -42,66667 v -42,66667 0,08333334 -49,33333 v -49,33333 0,08333334 -49,33333
You can try setting StandardMeshReader.ReadInvariantCulture = false, it may read correctly. But then if you try to load a normal OBJ (with period as decimal separator), it won't work properly.
Oh, thanks a lot :) I didn't think that was gonna cause a problem, because other editors handled it just fine. Changed the script to export with dots now and it works. Happy to mark this as closed then :)
many editors don't handle this at all...which means as long as you export and import in the same locale, it works fine =) It's if you exchange files with someone in period-separator locale, then it's a problem. (So you might find that these other editors won't import your period-separator files properly.)
It is a tricky problem because nothing in an OBJ file explicitly specifies the number formatting. The only way to tell is to scan through the file and make a guess based on text analysis, etc like statistics of commas vs periods, etc.
Most files "in the wild" use a period separator, so that's what we assume as the default
I have tried importing a mesh using the instructions in the article "Mesh Creation and Spatial Queries with g3Sharp". Importing doesn't throw any errors, and DMesh3.CheckValidity() finds it to be valid as well. But when i try to do a RayCast, also like explained in the article, it doesn't hit anything. So i tried exporting the mesh to check how it looks, like suggested. Originally the mesh looked like this: After importing and exporting the mesh like explained, it looked like this: This explained why the RayCast wasn't gonna hit anything but i couldn't find an answer to why it is getting deformed like this on import.
Is there anything I might have missed in the article ?