#animation tree broken

6 messages · Page 1 of 1 (latest)

silver barn
#

Im trying to use an animation tree to animate a simple 2d character, following this tutorial: https://www.youtube.com/watch?v=Xf2RduncoNU

i did all the steps but my character does not animation, he just stays facing backwards when I move him.

I tried to add diagonal movement though...

code:

extends CharacterBody2D

const SPEED = 100.0
const ACCEL = 5.0

var input: Vector2

func get_input():
    input.x = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left")
    input.y = Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up")
    return input.normalized()

func _process(delta):
    var playerInput = get_input()
    
    velocity = lerp(velocity, playerInput * SPEED, delta * ACCEL)
    
    $AnimationTree.set("parameters/Walk/blend_position", velocity)

    move_and_slide()

i dont know why mine has a "start" and "end" node on the animation tree, they were there when i created it and they wont go away

Learn how to move and animate a top down 2d sprite in Godot. I go over basic physics movement, AnimationPlayer, and AnimationTree.

Spritesheet: https://raw.githubusercontent.com/jontopielski/Top-Down-Sprite-Tutorial/master/player/PlayerSpriteSheet.png
Code: https://github.com/jontopielski/Top-Down-Sprite-Tutorial

00:00 - Intro
00:07 - Scene S...

▶ Play video
#

i connected the start node to the walk node

and I changed the code to $AnimationTree.set("parameters/Walk/blend_position", playerInput * Vector2(1,-1))

and now it's animation, but it's acting completely crazy

#

no matter what I try the animations are super laggy and keep going the wrong direction