This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

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... :(

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

How can I fix this?

Thank you!

in Engine by (688 points)

1 Answer

+1 vote
Best answer

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.

by (692 points)
selected by

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 :)

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.

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 :)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.