#Animation and movement speed syncing

1 messages · Page 1 of 1 (latest)

hollow oracle
#

Hey everyone, I've been wondering since yesterday on how I could match my character's movement speed with the animation so that I can get rid off sliding movement, I've looked up a couple forums although I'm still not sure what methods people generally use, I've considered manually changing them till they match although I wanted to hear your take on this problem, thanks in advance.
I also wanted to involve an accelerative movement system so that changing a movement direction or going from idle to sprinting won't look snappy.

strange plover
# hollow oracle Hey everyone, I've been wondering since yesterday on how I could match my chara...

root motion driven animation to perfectly sync movement to animation. however, this is hard to get right and generally just less responsive.
there are applications like "motion matching" on the store that try to find an animation from a dataset to match the motion vector you want to move in. something also used in AAA games.

and of course you could not use root motion and manually try to match speed/movement. that is usually most responsive but results in a motions not perfectly aligning with movement.

in one of my games i currently have root motion based animation, mainly, but rotation around the character axis is handled in code so that its more responsive.
and as for speed up and slow down I just adjust the speed of the animator, or possibly better to make a blend tree. in animation states you can also set a speed.

one more option:: handle root motion contextually, overwrite OnAnimatorMove and make calculations based on the root motion delta position, or decide whether to directly apply it or not, based on what state you're in
https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnAnimatorMove.html

#

I also just use a character controller instead of a rigidbody

#

when i want really tight movement for lets say a 2d platformer, I'd probably also write all the movement behaviour myself (and not let the builtin rigidbody physics take care of acceleration/deceleration etc)

hollow oracle
#

since this form of movement doesn't take into account collision which causes glitchy collisions

strange plover
# hollow oracle would a character controller be thr equivalent of `transform.translate` ?

I don't quite understand the question, but i think what you mean is
https://docs.unity3d.com/ScriptReference/CharacterController.Move.html
essentially like translate, but accounts for physics motion interpolation. I also use a character controller for my game

so it's not like the component itself is the equivalent, a character controller is just a special type of collider with a capsule shape that handles physics for you to some degree, like making it easy to not get stuck at surfaces, having better slope behaviour etc.
some callbacks are also different like
https://docs.unity3d.com/ScriptReference/CharacterController.OnControllerColliderHit.html

#

also as for what rigidbody related movement causes proper movement collision interpolation or teleporting, someone made a visualization:
#old_programming message

hollow oracle
#

@strange plover thanks for the deep explanation, I didn't know there was a separate collider for a character controller, I was using a simple capsule collider and applying the movement through it's rigidbody

strange plover
#

yeah, usually you don't use a rigidbody with a character controller because the later is already meant to handle collision resolution