Closed Daniel4144 closed 2 years ago
@Daniel4144 thanks for reporting!
You're right, that's problematic indeed. Draco itself does not define coordinate space handedness whatsoever, but DracoUnity is most often used in a glTF context, where a coordinate system conversion happens upon decoding.
I need to have a closer look where exactly this happens.
Two solutions come to mind:
The latter seems more sound to me
@Daniel4144 I had a close look. Space conversion already is an option for DracoMeshLoader
:
public DracoMeshLoader(bool convertSpace = true) {
this.convertSpace = convertSpace;
}
So in your example, try:
Mesh mesh2 = await new DracoMeshLoader(false).ConvertDracoMeshToUnity(result[0].data);
An option for encoding is still missing, but will be required for glTF export.
Thanks @atteneder for the help. I have missed that option, but that should work. I am using DracoUnity to save generated colliders and load them later and as a workaround I have scaled all colliders with -1 after loading, but the builtin option is way better.
Encoding or decoding a mesh mirrors the mesh along the x-axis, I could not determine which one flips the coordinates. The following sample code encodes and decodes a single triangle and displays the mesh before and after, they should be equal:
The same happens for all meshes, not only in this sample with a single triangle.
DracoUnity version 4.0.2 Unity version version 2020.3.30f1