I am trying to make my characters upper body spin horizontally ( around the Y axis) when I move the mouse for a third person shooter. Right now I have an empty object acting as the target that spins when I move the mouse, and I have the lowest spine bone slerping to its rotation. But what I WANT to happen, is to have each of the 3 bones in the spine spin 1/3 of the way to the target rotation, instead of spinning the lowest one all the way. I have been struggling with this for 3 days now and I would appreciate any help.
Hello, I had the same issue you had on a game I was developing, Sadly I couldnt rotate the half superior part of my char and stay static the lower part. that was because the animations overwrite my rotations :S if you happen to find a way, please let me know!
The animation override isn't my problem, i've got that working. The problem is that I don't just want to rotate the lowest bone all the way to the target, I want each of the 3 bones to rotate 1/3 of the way there, I thought using Slerp(spine1.rotation,target.rotation,0.33) would do it, but it doesn't seem to work as expected. I don't think I am explaining myself very well, so I'll try to give an example: If the target rotation is 90 Degrees, the bottom bone should be facing 30 Degrees, the middle bone should be facing 60 Degrees, and the top bone should be facing 90 Degrees ( the target rotation).
No worries , im not explaining very well.... Because he needs to face where the mouse is pointing, he is not just spinning in place, he is aiming at where the player is aiming.
I think I understand you now mhmmm ..... have you checked the procedural example from the Unity Examples?, If i can remember well, they use something similar of what you are looking at :S http://unity3d.com/support/resources/example-projects/locomotion-ik I think that can help you
What is going wrong exactly? One thing I see, is that if spine2 and spine3 are parented, this code will not work, as assigning this slerp to spine2.rotation would also affect spine3 (resulting in a completely different slerp the next frame, having both spine2 and spine3 go berserk).