0
\$\begingroup\$

Assume I have two animation cycles:

  • Walking
  • Crouching

Both assume that the model's pivot is on the same level as the model's feet.

Now I also have two animated transitions:

  1. Get on all fours while walking
  2. Climb onto a (table)

The first is not too complex. The model walks upright, then gets down on all fours (animation 1) and crouches. Pivot remains on the same level, all fine.

What I want:

However, I can't get my head around the second transition. I want the model to

  1. walk up to the table (pivot on ground level)
  2. climb onto the table (animation 2) (pivot..?)
  3. crouch on the table (pivot on table level, 1 m above ground)

What I have:

The climbing animation (2) assumes pivot to remain on ground level and simply animates the model's climbing up. I built a StateMachineBehaviour which raises the model to the table level as soon as the climbing animation is complete. From then on the pivot is on table level and the crouching can continue.

This seems to work fine in a standalone application, however, in multiplayer, where the models' transform and animator state are not necessarily synchronized in the same frame, this prooves problematic. One can clearly see the model jump when the change in the model's position arrives one frame earlier than the switch from climbing to crouching animation.

What I tried:

I thought it might be a better idea to have the pivot move gradually from ground level to table level over the duration of the climbing animation (2), instead of having one instant jump at the end. This way network synchronization would be much more robust because of the relatively small change per frame. Also this approach would much closer resemble the actual thing that's happening in the real world, which is generally a good thing. I tried offsetting the root transformation of the animation clip, and accomodate the modification by adding the negative offset to the root bones. This however did not work, as there seems to be no animatable translations in Mecanim animation clips. So im stuck at this approach.

Question:

Is there a better way? A simpler way? How are you guys tackling this?

\$\endgroup\$
  • \$\begingroup\$ If I am not wrong, can't you do it by just translating your object?? Please Correct me if I could not understand your question \$\endgroup\$ – Hamza Hasan Feb 16 '16 at 20:47
  • \$\begingroup\$ That's what I did in my first solution: translate right at the moment when the transition animation ends, because the transition anim required the pivot to remain on the floor, and the following crouch animation required it to be on table. If I want the pivot to move gradually, then I have to translate the object gradually, while the animation gradually accomodates for the translation (or the object would begin to float up). That's where my second solution failed: I was unable to have the animation accomodate for the gradual change in pivot position. \$\endgroup\$ – Thomas Hilbert Feb 16 '16 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.