If I have animations that goes from walking to running or running to sprinting (NOT root animation) and I want to add an animation as a transition right at the beginning of the blend like an impulse movement before blending over to the sprinting. This impulse would only happen at start and then the sprinting animation would blend in and keep looping as long as I sprint after, to create a more natural movement. How can I make something like that happen in the animgraph?
Thank you!
There’s an example of this in the third person sample:
You just add a transition animation between the two states. So instead of Walk → Run, you do Walk → Walk-To-Run → Run.
Here’s another example from the Setting Up Character Movement tutorial:
Hmm, yes, thank you! This is one way… But are there other ways? Nothing wrong with this one but it just seems I would loose quite a bit of control… The state becomes dependent on a specific path in the state machine and could lead to a lot of state machine spaghetti. Would much rather it blends in on top of a cached pose or other as a layer that only triggers as a impulse to the beginning of the sprint animation…
The Advanced Locomotion System V4 asset seems like it has both ways implemented. At 1:46, it uses a state machine that has “RunStart → Running”, but later at 1:59, it blends an impulse onto the sprint based on acceleration.
There’s multiple ways to do it, so I would just find one you like the best. Also remember, you can put state machines inside other state machines (they’re just graphs), so they don’t all have to be in one graph.
Yeah I think ALS has a great solution. I’m looking at something similar… What I imagine is a seperate state machine with the impulses. What I’m thinking is:
- State machine where I blend all movement direction animations and cache them.
- State machine for directions (simply ensuring the right animation is triggered by the direction input) that pull animations from the first state machine with animations
- A details (impulses) state machine that adds the impulses as additives to the cached animations
- The final output comes from the state machine with the directions
However what I struggle to understand is:
- How do I in a effective and good looking (elegant) way make the logic for the above. What are the variables and logic I need to pull that of smoothly?
- I want to make sure it’s very modular, that I can add a combat system on top of this as another state machine for example that uses the cache from the other ones. I also want all the movement to be as natural as possible, interpolating/using curves to accelerate into blends for example.
That’s where the artistry comes in. I haven’t made an advanced locomotion system like ALS, so I don’t know the exact formula, but I would say to keep things as simple as possible and not get overly complex (I actually think the ALS system is a little too complex, but that’s just from watching the video).
For modularity, you could build one base state machine (i.e. the logic), then switch the animation clips for each weapon (i.e. the content) through blueprints. This way, you could have as many animations as you want without having to manually add them to the animation graph. This is like switching skins on a character, where you change just the model and not the logic.
This thread has a similar problem: Can you define poses/state-machines, porgramatically, inside the animation-BP (or elsewhere at all)?, so you can read that for more help.
Indeed!
I agree. ALS is beautiful but I think one could achieve a similar result with half the complexity. Nevertheless it’s a lot of complex logic. To do it well it takes more than what the documentation tutorials provide. I wish I had someone that I could get some guidance from to build the logic:
- Calculating relative direction (forward, backward, left, right) rather than just direction.
- Calculating acceleration and setting curves that affect and interpolate the blends between speeds.
- Setting up the state machines so that the additive impulses are smoothly happening at the start of direction/speed change.
Been searching the forums a lot… Any more threads you think I should check out or perhaps someone on the forum that is willing to bounce some ideas and explain some things?
Thank you!
I don’t know any threads other than that one cuz I was in it, but you can look at other animation graphs (like the video) to get some ideas. I learned what I know just from looking at other examples.
This video is pretty useful:
Even though it’s more for procedural animation, it still is helpful for animation in general.
1 Like