@@ -57,7 +57,7 @@ public static IEnumerator<string> CreateOBJFileContentAsync(GameObject target, b
57
57
58
58
objBuffer . Append ( $ "# { target . name } ") . AppendNewLine ( ) ;
59
59
var dt = DateTime . Now ;
60
- objBuffer . Append ( $ "# { dt . ToString ( CultureInfo . InvariantCulture ) } ") . AppendNewLine ( ) . AppendNewLine ( ) ;
60
+ objBuffer . Append ( $ "# { dt . ToString ( CultureInfo . InvariantCulture ) } ") . AppendNewLine ( ) ;
61
61
62
62
Stack < Transform > processStack = new Stack < Transform > ( ) ;
63
63
processStack . Push ( target . transform ) ;
@@ -100,25 +100,25 @@ private static void CreateOBJDataForMesh(MeshFilter meshFilter, StringBuilder bu
100
100
101
101
var transform = meshFilter . transform ;
102
102
103
- buffer . Append ( "g " ) . Append ( transform . name ) . AppendNewLine ( ) ;
103
+ buffer . AppendNewLine ( ) . Append ( "g " ) . Append ( transform . name ) . AppendNewLine ( ) ;
104
104
105
105
foreach ( Vector3 vertex in mesh . vertices )
106
106
{
107
107
Vector3 v = transform . TransformPoint ( vertex ) ;
108
- buffer . Append ( $ "v { v . x } { v . y } { v . z } \n ") ;
108
+ buffer . Append ( FormattableString . Invariant ( $ "v { - 1 * v . x } { v . y } { v . z } \n ") ) ;
109
109
}
110
110
buffer . AppendNewLine ( ) ;
111
111
112
112
foreach ( Vector3 normal in mesh . normals )
113
113
{
114
114
Vector3 vn = transform . TransformDirection ( normal ) ;
115
- buffer . Append ( $ "vn { vn . x } { vn . y } { vn . z } \n ") ;
115
+ buffer . Append ( FormattableString . Invariant ( $ "vn { - 1 * vn . x } { vn . y } { vn . z } \n ") ) ;
116
116
}
117
117
118
118
buffer . AppendNewLine ( ) ;
119
119
foreach ( Vector3 uv in mesh . uv )
120
120
{
121
- buffer . Append ( $ "vt { uv . x } { uv . y } \n ") ;
121
+ buffer . Append ( FormattableString . Invariant ( $ "vt { uv . x } { uv . y } \n ") ) ;
122
122
}
123
123
124
124
for ( int idx = 0 ; idx < mesh . subMeshCount ; idx ++ )
@@ -129,7 +129,7 @@ private static void CreateOBJDataForMesh(MeshFilter meshFilter, StringBuilder bu
129
129
for ( int i = 0 ; i < triangles . Length ; i += 3 )
130
130
{
131
131
buffer . Append ( string . Format ( "f {0}/{0}/{0} {1}/{1}/{1} {2}/{2}/{2}\n " ,
132
- triangles [ i ] + 1 + startVertexIndex , triangles [ i + 1 ] + 1 + startVertexIndex , triangles [ i + 2 ] + 1 + startVertexIndex ) ) ;
132
+ triangles [ i + 2 ] + 1 + startVertexIndex , triangles [ i + 1 ] + 1 + startVertexIndex , triangles [ i ] + 1 + startVertexIndex ) ) ;
133
133
}
134
134
}
135
135
0 commit comments