nsmryan / RustRoguelike

This Rust Roguelike is a Roguelike written in Rust.
17 stars 3 forks source link

Unity Jump Wall Animation #398

Open nsmryan opened 2 years ago

nsmryan commented 2 years ago

play the jump wall animation in unity.

nsmryan commented 2 years ago

The animation definitely does not line up with the movement right now.

There are a number of issues. One is that the player seems to move forward too quickly and snap back sometimes. The other is that the jump wall animation seems to include a setup and a jump, which needs to happen fairly quickly. Currently even if it kind of works, the animation doesn't complete in time.

nsmryan commented 2 years ago

I tried to increase the speed of the animation so it would always complete in exactly the time needed to stay in the fixed duration allocated to animations. It seems like there are a couple things that make this complex.

One is the transition time- I imagine we might want some transition time to allow the animations to blend? It seems like you can set this to a fixed time with the "Has Fixed Duration" setting in the transitions, and then set a "Transition Duration" in seconds.

Another is that the jump wall needs to complete within a single step, unlike walking or running. This seems possible if we could get the speed to exactly match time time, or we could do something like check for this animation and allow it to play out completely but at the higher speed.

I also believe that I saw the animation reach its end and not loop, perhaps because there is no self transition? The issue here is that if there is a self transition, we have to ensure that it does not occur within the same frame and play the animation twice. We could either just time things correctly, perhaps have a parameter that inhibits self transitions that we set while the state is playing, or perhaps have a way to reset the motion's place back to the beginning at the start of the movement for some movements?

MicroChasm commented 2 years ago

I definitely think we need to build in some time for transitions, I wonder if it is possible to set those when you generate the state machine? we could use a standard amount of time for each transition.

I would say that for the wall-jump, checking to see if this kind of animation is playing and modifying its speed to complete within the timeframe seems like the best idea.

The last point is interesting, since we are not returning to an idle state. I feel that maybe I should make the wall-jump end a little earlier, so that she doesn't commit to a running stance at the end. If we have her land on the other side and then recover and then just pause it there, she can transition to anything after that. I'm not 100% sure if that answers the question though.