I'm running into an issue with setting the speed of an additive animation. Each of the vehicles use a number of different additive animations which are modulated by our physics implementation. We have additive animations for each wheel and for each physical component such as:
This approach has worked for us when applied to vehicles with four wheels. However, once we extended it to vehicles with six wheels the middle wheel's rotation animation speed became uncontrollable. Once the animation's speed is set, its playback speed will modulate from some arbitrary value to another.
What this looks like is that as the vehicle is travelling, the four other wheels (both front and both rear) rotate at the correct speed whereas the middle speeds start at a stop, increase speed, stop, and begin reversing; repeating the pattern forever. This uncontrolled playback continues even after the vehicle has stopped and all speeds for the animations have been set to 0.
While debugging I've looked at the values for each of the animation states both before and after the speed is set and have validated that the values exactly match those being sent by our physics layer and that our physics layer is producing the correct values.
I have also validated that each of the animations run individually by using the gameObject.SampleAnimation() method as described in Unity Docs along with a custom editor which I've written.
This behaviour with our additive animations isn't confined to just the mid-wheels spinning however, this is the most clear cut case which I can explain. I've exhausted all of my debugging knowledge and am looking to the community to help, please!
asked May 10 '12 at 10:07 PM
Are you sure that the middle wheels have a normal animation (which propably hold them in position) running? Additive animations, as the name said, will be added to the result of the normal animations. If there's no other animation setting the wheels rotation to a basic level, each additive animation step (frame by frame) will be accumulated. If you just want to split animations to sub groups / bones, you can use a layered animations and use a MixingTransform.
Additive animations are ment to "blend it over" an existing animation. The docs example is a run animation + an additive lean animation. So the run animation controls the full body, but the lean animation is added afterwards.
answered May 10 '12 at 10:19 PM