- Home /
FixBlenderImportRotation wiki scipt x mirror issue
Hello, i found this cool editor script to fix blender's rotation at import. But soon i noticed it is mirroring x axis which is also cause of flipped normals (he is fixing them at line 63).
So i put x*-1 in this line:
vertices[index] = new Vector3(vertices[index].x *-1, vertices[index].z , vertices[index].y );
And commented out code that is flipping normals.
It works, but i'm not sure if i'm doing it right and i don't know why is rotation at line 31 needed. Shouldn't be swapping axis sufficient?
Thanks for your answers
Answer by Harrier · Jul 18, 2016 at 06:24 PM
Partially figured out, unity front is z+ and blender front is y-, code posted in question rotated front to back.
Solution:
vertices[index] = new Vector3(vertices[index].x , vertices[index].z , -vertices[index].y );
But still i have no idea why rotation is needed.
Its not just one axis pointing a different way but a left-hand vs a right-hand system.
Answer by meat5000 · Jul 18, 2016 at 11:29 AM
This always worked for me:
http://forum.unity3d.com/threads/blender-unity-rotation-fix.181870/
Remember to apply loc, rot, scale and you could also try the Built-in rotation fix, that was probably derived from Mirgars fix.
Does this solution cause issues with LookAt?
Quote from FixBlenderImportRotation wiki:
Ins$$anonymous$$d of all the objects in the object to be rotated by x-90 degrees, the mesh data is properly rotated, meaning transform.forward is the real forward axis, and lookAt actually works!