26-05-2019, 10:49 PM
(26-05-2019, 08:04 PM)Saismirk Wrote:After making a whole new project just to make the skinned cloth work, everything appears to work properly except for the mesh being rendered 90 degrees sideways for some reason. This happens to any skinned mesh even on Edit Particle mode. Nothing seems to fix this.
I should add that everything seems to work just fine with non-skinned meshes, even just switching a skinned mesh to be rendered with a regular Mesh Renderer/Filter will make the cloth render properly, but for Skinned Renderer the meshes are rendered sideways and in messed up positions. I've explored any number of solutions from X-Forms in 3dsmax to using Maya and Blender to reimport the meshes. It's definitely related to bones as that was the problem initially with Bone Weights.
Update:
I have found that problem lies in skinned meshes defaulting to their root bone's rotation values and the mesh's pivot position, overriding any skin positioning. For example, I use 3dsmax for my modelling using biped rigs, the meshes in question were assigned to the pelvis bone (root). Even though the biped as a whole has 0 rotation values, the pelvis had (-180, 0 , -90) rotation values, and the mesh had a pivot located at the feet. At runtime, even though the skinned mesh was properly positioned, Obi Cloth made it take the exact same rotation values as seen in 3dsmax, despite not matching the actual bone's rotation after import, and position it at the location of the pivot.
I managed to fix this by rotating the biped as a whole such that the pelvis bone had a global 0,0,0 rotation and the mesh's pivot matching the root bone's position. Skin wrapping the whole thing and finally rotating the biped back to its original position, and Xforms for good measure, then it was good to go.
I'm unsure if this is a unity problem with 2019's new fbx import features, or Obi not handling the root bone's transform properly. In any case it is fixable.
Things that were not related to this issue:
- Unity's mesh optimization options. They indeed mess up the simulation and reinitializing everything fixes the issue (as if it wasn't hard enough to set up each cloth properly, you have to do everything from scratch).
- Skin weight bones settings: Increasing the number of bone weights fixes the null vertex weight issue but it was unrelated to the mesh getting messed up in runtime.