Uncentered animations

What is the best way to do animations that are not centered in the pivot of the object ?

The best example is the jumping animation

When a player jump, it goes up some units, this up translation is optimal when is done in the animation, or the transform of the object should control it ?

I mean, if done in the animation, the player actually goes up in the local space, but the object itself remains in the floor in the game engine.

If done in the transform, the player moves like jumping but never goes up in the animation, and the transform goes up (animated) in the game engine.

Well, waiting to receive some thoughts about it, guides or comments are welcomed. ;D

.ORG

most of the time i’d do it with the transform so i can script speed vs gravity/jump height to tweak in the inspector. plus, depending on how your character is set up, you might need to move your collider(s) with the mesh.

I thought about that too, animating the collider to coincide with the animation itself.

.ORG

The second way just seems to make more sense. Diagram time!

The little black dot is the collider. The blue arrow is the intended motion, the red arrow is the actual motion. Because you animated the upward motion instead of programming it, your character hangs in the air, vertically motionless for a few seconds. This is because the collider is going down but the animated character is going up. So you could include the colliders in the animation, but why put yourself through extra steps?

42632--1563--$diagram_551.png