#How do I animate a Sprite3d?

1 messages · Page 1 of 1 (latest)

fresh warren
#

are you changing the animation in code?

#

can you show it?

hollow valve
#

Tutorial series on how to make game like Pokémon in Godot. I'll go over adding walking animations and also being able to turn in the same spot.

Part 3: https://youtu.be/wkNvqmAvtpo

Project Files: https://github.com/arkeve/Godot-Pokemon

Twitter: https://twitter.com/ArkeveGames​

Fixing small bug: (0:00)
Adding AnimationPlayer: (0:28)
Adding An...

▶ Play video
fresh warren
#

what does your AnimationTree looks like?

hollow valve
#

Like this?

fresh warren
#

you use "Walk"

#

but is lowercase here

hollow valve
#

If there are other ways to animate it, I'm open to suggestions.

fresh warren
#

the string should match the state name exactly

hollow valve
#

I copied it from the Inspector, but I'll see if changing it works.

fresh warren
#

the inspector will make it TitleCase

#

I think this is what matters

#

you can use Blend3 for idle-walk-run logic.

#

is a bit more advanced

#

but is cleaner

#

but I think it needs to be a different tree type

hollow valve
#

Changing to lowercase removed the errors, but the animation still doesn't play.

fresh warren
#

click the connections and check the inspector

#

change mode to enabled

#

do you have many more animations?

hollow valve
#

Yes, but only three are available so far.

hollow valve
fresh warren
#

is it working now?

hollow valve
#

Nope.

fresh warren
#

it might be because your are calling travel every frame

#

I suggest you create a StateMachine to check the current state before changing the animation

#

or even a variable to store the current animation

#

you can create a funtion to simplify your code

var _current_anim:String

func play_animation(anim:String):
  if _current_anim != anim:
      anim_tree.travel(anim)
      _current_anim = anim
hollow valve
#

Frankly, I didn't understand how to do that and was afraid I'd annoy the guy talking to me, so I just redid it with AnimatedSprite3D as opposed to AnimationTree.

#

It still is a bit scuffed, but it is working now at least.

#

Thanks for your patience. @fresh warren