I have a mesh (verticies, indicies, normals).This mesh uses following world coordinate system:
- Forward: x
- Up: z
- Right: y
I am trying to convert it to a different coordinate system:
- Forward: z
- Up: y
- Right: -x
I swizzled verticies from xzy to zy-x and the geometry looks fine. But the same trick didn't work for normals. What I am missing? Should I use some kind of matrices?
Thank you for any help you can offer!
EDIT Red lines - normals vizualization
Here is a part of code that shows normals:
GLKVector3 up = GLKVector3Make(0, 0, 1);
GLKVector3 normalVec = GLKVector3Make(normalBuffer[i * stride + normalOffset],
normalBuffer[i * stride + 1 + normalOffset],
normalBuffer[i * stride + 2 + normalOffset]);
GLKVector3 axis = GLKVector3Normalize(GLKVector3CrossProduct(up, normalVec));
float dotProduct = GLKVector3DotProduct(up, normalVec);
normalNode.rotation = SCNVector4Make(axis.x, axis.y, axis.z, acos(dotProduct));