Hammer Non-Linear Animation and Animation State Graph trouble


Hi - I’m trying to learn non-linear animation in Blender, and bring those over to PlayCanvas and I’m having a lot of trouble, I’m getting overwhelmed and having to continually start over and try again.

In the above scene, I’ve got a hammer with an up and a down state: up being where the hammer is just idle/at the ready, and down being the full animation where it has swung.

  1. The hammer idles correctly, and I got it working with the click down, but then it doesn’t return back up. I can’t figure out why
  2. When the hammer stays in the down, it starts back up the idle animation (kind of like a simple hover/hovering), which isn’t what I was trying to have happen.
  3. If I mouseup or touchup before the down animation is done, the hammer stops where it’s at and doesn’t return to the up animation.
  4. I moved the hammer up above the ground plane in the editor, but in the player it just moves back to the wrong location

My goal is to have the hammer up animation idling/floating by default, play the down animation on mouseDown or touchDown, and then have the hammer return to the up animation upon mouseUp or touchUp. Any suggestions? I really appreciate any info, please let me know what more I can provide.

Hi @ahainen!

The project you shared doesn’t seem to show what you describe, because for me it’s moving up and down constantly without pressing anything.

It sounds like you need a transition from up to down with a trigger condition (instead of a boolean condition) and you need a transition from down to up that has an exit time of 1.

If you only have one animation, you probably need to use API’s like speed and reset to achieve the desired result. (Or create a workaround with an empty state or something).

Thank you for the reply. I’m…realizing I’m in way over my head. Going to try a different project. Regardless, thank you for the reply.

Sorry, you can ignore this. I was on mobile at that moment.

I applied my suggestions in the project below. The result seems a little better to me. I’m not sure how to get the hammer back to the default position. I think you need an animation that does the opposite to reverse it or extend your current animation.


1 Like

Thank you so much for doing that! I’m going to take some time to look it over and see what I can learn.

I had two animations: one for idle, and one for the full swing, which I was just going to have it play in reverse for the return. I think this wasn’t a great route the more I think about it and reviewing your post. I didn’t account well for a speed or reset…but also, I’m kinda fumbling through how to do this as/planning as I go :sweat_smile:

I’ll reply with questions as I have them. Regardless, thank you so much for your time and reply, I really really appreciate it

I think this will be perfect. Is this full swing animation currently in your project? I guess you want to show a full swing when the player press the button?

I just tried to use the reset API, but this doesn’t work as expected because it is not resetting the animation itself. You can skip this suggestion.