[Solved] Blender Y coord <-> Unity Z coord conversion for layouts
Posted: Wed Mar 25, 2020 10:00 am
Hi everyone,
While working on the Hall of Champions easter egg, I have found a bit of a strange problem that I'm not sure how to fix yet:
The first image is the layout in Blender, I have placed the start marker in that hallway in the south part so you're supposed to enter there, facing north.
The second image is what happens when I load this layout into Unity, it somehow gets reversed so you start from the north, facing south.
I think it has to do with left-handed vs right-handed coordinate systems. Left-handed is Unity's, right-handed is what Blender uses. I usually run away when matrix math gets involved but I don't think I can escape it this time. I didn't notice it with this particular mesh since the hallway is dead center in relation to the cylinder's origin so even when rotating, the start marker is in the right place.
I have two other variations of this mesh for testing purposes where the hallway is slight off-center and that's where I ran into the problem that the start marker is placed outside of the mesh in Unity, causing you to spawn in the void.
Please note that this is not the rotation 'error' that people run into when importing single meshes into Unity but more of an issue with the translation of complete scene coordinates from Blender to Unity.
I'll try to figure this out today to create a workable solution for myself but if anyone has any input or a solution, that would be greatly appreciated. I can supply source files if needed, including the script I use to export the layouts from Blender to Daggerfall Unity but as far as I know, I'm the only person who has dabbled in this so far. My Google-fu has not yielded any results yet, other than wordy explanations of what's going on so I'm letting that sink in atm.
While working on the Hall of Champions easter egg, I have found a bit of a strange problem that I'm not sure how to fix yet:
The first image is the layout in Blender, I have placed the start marker in that hallway in the south part so you're supposed to enter there, facing north.
The second image is what happens when I load this layout into Unity, it somehow gets reversed so you start from the north, facing south.
I think it has to do with left-handed vs right-handed coordinate systems. Left-handed is Unity's, right-handed is what Blender uses. I usually run away when matrix math gets involved but I don't think I can escape it this time. I didn't notice it with this particular mesh since the hallway is dead center in relation to the cylinder's origin so even when rotating, the start marker is in the right place.
I have two other variations of this mesh for testing purposes where the hallway is slight off-center and that's where I ran into the problem that the start marker is placed outside of the mesh in Unity, causing you to spawn in the void.
Please note that this is not the rotation 'error' that people run into when importing single meshes into Unity but more of an issue with the translation of complete scene coordinates from Blender to Unity.
I'll try to figure this out today to create a workable solution for myself but if anyone has any input or a solution, that would be greatly appreciated. I can supply source files if needed, including the script I use to export the layouts from Blender to Daggerfall Unity but as far as I know, I'm the only person who has dabbled in this so far. My Google-fu has not yielded any results yet, other than wordy explanations of what's going on so I'm letting that sink in atm.