Animation pose

Hey guys,

I’m currently working on a fairly big project, and I’m starting to ask myself how I should go about animations. I’m currently play testing with free asset on the asset store, and there is two very different approaches animation :

  1. The animation makes the character move, rotate etc
  2. The animation don’t change character position, and I have to do movement myself

Currently, my “player” walk, run animations don’t make the model move, and I use a navMeshAgent + code to makes the character move (a bit STR-like, you click somewhere, guy goes there).

This is totally fine for me, I’m a dev and don’t have any problem doing the movement work etc, but I face problems.

I downloaded some really cool animations on the asset store (Warrior packs 2&3), but they make the model move, and it f**** up everything (which is normal).

So, before going any further (and as I probably pay someone to do animations for my project, or learn it myself) what are the pros&cons of both ? Should I only work with animations that doesn’t change model positions ? Or do everything in the animations ? Or maybe I can do both but I yet don’t know how to proceed.

Thanks a lot if you have any suggestions

Animations like walk, run etc, have motion baked into them, it is best to sync this with the character motion. The speed of the animation should be set according to the calculated speed of the character that you are setting up ie, the faster your character runs, the faster the animation plays, then move the character according to the animations delta position.

There are quite a few tutorials on YouTube etc, that describe how to move & animate a character, however, while these look ok, at closer inspection, you’ll find that the animation doesn’t sync with the actual motion of the character, so they appear to kind of moonwalk and can bounce & bob about the place.

Take a look at the 3D Game Kit - PlayerController. This has an example which syncs the animation to the motion, so that each foot-step that the animation lands on the ground is coordinated with the actual speed of the character, which makes the motion fluid and realistic. In short, the animator is providing the delta position to the character controller, which it uses to physically move the character.

PlayerController->CalculateForwardMovement() calculates the speed of the character during locomotion, which it updates the animator with

 m_Animator.SetFloat(m_HashForwardSpeed, m_ForwardSpeed);

PlayerController->OnAnimatorMove() queries the animator for the delta position of the animation

movement = m_Animator.deltaPosition;

and then tells the CharacterController to move the character;

m_CharCtrl.Move(movement);

Of course, this last line can be changed to suit a navmesh agent;

navMeshAgent.Move(movement);

Using the animators deltaPosition provides a much more fluid and realistic experience, as the character will move about according to how the animation intended it to rather than moonwalk about the place.

If you want the quick and easy solution, just turn off the “root motion” toggle on the animator. Of course, you’ll get the “moon walking” @craigjwhitmore is talking about, but root motion takes a long time to get right, and has very many pitfalls.

Thanks for your answers guys. Maybe I explained myself poorly, but I already know/do what you suggested and it’s working fine. My question was more about “what type of animation should I work with” ?

For testing purposes, I downloaded a bunch of free animations from the asset store, and even for walk/run, some have root motion applied, but some have not (ie. the character walk in place → moonwalking (which is not a problem)).

I guess I could work with both type of animation, but that seems a bit stupid to not stick to one and have two different implementations for the same thing, and a lot of overhead.

Thanks again guys

Up, still looking for advice :stuck_out_tongue:

We discussed root motion somewhere in this thread .

The tl;dr is that root motion based animation is probably going to be harder to implement, but better looking.

That’s exactly my questions, I’ll read into that. Thanks a lot