x


Addititive Animation Not Responding to Speed

Hello there,

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:

  • RPM - modulated by setting speed (+1 is 1 RPM forwards, -1 is 1RPM backwards. Can get set to any value theoretically). Sets speed property on the AnimationState, wrapmode is set to loop and "loop" is set to true.
  • Suspension - modulated from 0-1, sets normalized time property on the AnimationState, wrampode set to clampforever and "loop" is set to false
  • Steering - modulated from -1 to +1, sets normalized time property on the AnimationState, wrapmode is set to clampforever and "loop" is set to false

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!

Thanks! Gerald

more ▼

asked May 10 '12 at 10:07 PM

GeraldOBBI gravatar image

GeraldOBBI
87 3 3 9

+1 For a good and well described question.

May 10 '12 at 10:20 PM Bunny83
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered May 10 '12 at 10:19 PM

Bunny83 gravatar image

Bunny83
45.4k 11 49 207

+1 for reminding me to check source assets!

May 10 '12 at 10:48 PM GeraldOBBI

Sorry, I should have made that clear in my initial post but yes we have a default "identity" pose animation which we loop over and over. These additive animations play on top of this animation however, it appears that the latest export of the model & animations didn't include the bones which control the rotation of the wheel. D'oh!

Once I had the artist re-export the model the problem completely disappeared. Let this be a lesson to everyone that you must ensure all bones are part of a looped animation when you are using additive animations!

Next time I'll be harder on the artists and ensure that all bones are part of the identity pose :)

Thanks!

May 10 '12 at 10:51 PM GeraldOBBI
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3790
x222
x104
x63
x38

asked: May 10 '12 at 10:07 PM

Seen: 550 times

Last Updated: May 10 '12 at 10:51 PM