Skip to content

Commit 9bd7266

Browse files
authored
Mesh export float accuracy fix (K0lb3#258)
* MeshExporter - use 9 significant float digits instead of 7 * Test: MeshExporter - obj precision fix
1 parent 5f40351 commit 9bd7266

2 files changed

Lines changed: 727 additions & 727 deletions

File tree

‎UnityPy/export/MeshExporter.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def export_mesh_obj(m_Mesh, material_names: list = None):
2424

2525
for v in range(int(m_Mesh.m_VertexCount)):
2626
sb.append(
27-
"v {0:.7G} {1:.7G} {2:.7G}\r\n".format(
27+
"v {0:.9G} {1:.9G} {2:.9G}\r\n".format(
2828
-m_Mesh.m_Vertices[v * c],
2929
m_Mesh.m_Vertices[v * c + 1],
3030
m_Mesh.m_Vertices[v * c + 2],
@@ -41,7 +41,7 @@ def export_mesh_obj(m_Mesh, material_names: list = None):
4141

4242
for v in range(int(m_Mesh.m_VertexCount)):
4343
sb.append(
44-
"vt {0:.7G} {1:.7G}\r\n".format(
44+
"vt {0:.9G} {1:.9G}\r\n".format(
4545
m_Mesh.m_UV0[v * c], m_Mesh.m_UV0[v * c + 1]
4646
).replace("nan", "0")
4747
)
@@ -56,7 +56,7 @@ def export_mesh_obj(m_Mesh, material_names: list = None):
5656

5757
for v in range(int(m_Mesh.m_VertexCount)):
5858
sb.append(
59-
"vn {0:.7G} {1:.7G} {2:.7G}\r\n".format(
59+
"vn {0:.9G} {1:.9G} {2:.9G}\r\n".format(
6060
-m_Mesh.m_Normals[v * c],
6161
m_Mesh.m_Normals[v * c + 1],
6262
m_Mesh.m_Normals[v * c + 2],

0 commit comments

Comments
 (0)