2D animation (loc) problem between 2 keyframes

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By bruteforce
:warning: Old Version Published before Godot 3 was released.

Hi all,

I am trying to create a “crouch” animation.

There are 2 keyframes on the timeline:

  1. standing character:
    enter image description here
  2. crouching character:
    enter image description here

The problem is, that the character goes down into the floor during the animation, and I have no idea why does it do this… :frowning:

I made a gif about the issue:
enter image description here

How can I fix this?

Thank you!

:bust_in_silhouette: Reply From: genete

You probably animated the position of the whole body. It only needs one (or more) new keyframe in the middle to keep the feet on floor.

Thank you for the answer!

All of the sprites are in a KinematicBody2D node, but I don’t animate this body, only its child sprites (body parts).

I have created a simplified project, that contains only one leg.
The node hierarchy is similar to this: cutout animation tutorial
enter image description here

The AnimationPlayer calculates wrong values between the keyframes, or I misunderstood something about how it works.
Here you can see, that I don’t change the KinematicBody2D’s properties:
enter image description here

I can add new keyframes (as you said), and it seems good in the editor, but the problem still exists between these new keyframes when I play the project.

I hope, I don’t need to put keyframes to every 1/60 seconds :slight_smile:

bruteforce | 2016-12-18 11:19

There is nothing wrong on Godot interpolations. The problem is that you animate both rotation and position of the leg at the same time. At the start and end keyframes, the foot position is on the correct place but in the middle, the combination of the rotation and the position of the kinematic chain (leg/shin/foot) places the foot on the wrong position.

Try to place two keyframes at 0.1 and 0.2 seconds to fix the foot place and live with that.

Alternatively create an inverse hierarchy where the foot is the root of the kinematic chain and so it wouldn’t move at all for that kind of movement.

genete | 2016-12-18 12:18

You’re right, thanks for the explanation!

The new keyframes at 0.1 and 0.2 are not perfect, the same problem appears at 0.05, 0.15… etc., and the foot “bounces” when I play the animation/project.

The inverse hierarchy is a good idea, but my other animations (eg. “run”) needs the original structure.

I have to find another way.

I’ll be back soon :slight_smile:

bruteforce | 2016-12-19 09:15