0 votes

I have a roll animation for my character, it rolls in the ground so i do a 360 degree rotation of the hip bone, at the end of the animation the hip bone stays at 360° rotation and when making the transition to another state such as idle, because in the idle animation the bone is 0° the transition does not flow continuously but rolls back from 360° to 0° making a flip back even though the position is the same how to fix? this with the AnimationPlayerState Machine transitions so is not with code but the solution might be.
Thanks in advance for any answer.

Godot version v3.4.beta1.official
in Engine by (430 points)

1 Answer

+1 vote

Maybe you could set the easing value of your last frame (360 degrees) to be as small as possible (0.00001) and add a dummy rotation frame of 0 degrees after that.

Here's an example scene:


[gd_scene load_steps=3 format=2]

[ext_resource path="res://icon.png" type="Texture" id=1]

[sub_resource type="Animation" id=1]
resource_name = "New Anim"
length = 2.0
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("Node2D:rotation_degrees")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 1, 2 ),
"transitions": PoolRealArray( 1, 1e-05, 1 ),
"update": 0,
"values": [ 0.0, 360.0, 0.0 ]

[node name="Node2D" type="Node2D"]

[node name="Node2D" type="Node2D" parent="."]
position = Vector2( 339.722, 285.905 )

[node name="icon" type="Sprite" parent="Node2D"]
texture = ExtResource( 1 )

[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
"anims/New Anim" = SubResource( 1 )
by (33 points)

thanks yeah i tought something like that like setting the last frame to 0 rotation but i think there might be a solution and not just a workaround

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 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 webmaster@godotengine.org with your username.