Ok, so I am working on a game in which a character has a long tail like a snake. I realized I can’t animate the tail with an animation because it would swing when the character turns, so I wrote a script for the tail bones that makes each tail bone use the parent bone’s rotation 5 frames back.
So I imported the model in FBX format, added the script to each tail bone, and it worked perfectly. The problem, though, is when I closed Unity and opened it again later, the tail was badly distorted as if the bones’ pivots have rotated or they are inheriting crazy rotation data. After a full day of debugging with no luck, I realized that if I repeat the process and import the model from scratch again, the script works great again. But again, if I close Unity, or perform a build, the tail is once again distorted.
Because of this I feel safe saying the script is not the problem, otherwise it wouldn’t work with a newly imported model. The model also should be fine or it wouldn’t work when freshly imported. I think the problem lies in Unity saving and loading the model. I did try to compensate with the script by adding a mathf.lerpangle to the rotation, and after some adjustment of the time setting it reduced the distortion, but the damping also kills the fluid snake-like movement which defeats the point of the script.
So my question is has anybody seen this problem and if so what do I have to do to fix it?