I was playing around with anim state graph yesterday to do a sample reloading animation with a model. I managed to link everything together and get it working but have a problem.
As you can see in the video the animation plays however their is a delay near the end of the animation plays where the animation goes back to the normal state. I was thinking that the animation plays too fast for the duration of the transition but playing around with speed and duration values in the state graph still cause a delay to happen no matter. For reference the animation itself is 3 seconds long, I put the duration of the transition for 3.000 seconds and played around with the speed of the animation but then the animation plays too fast for the duration to catch up. How can I defeat that delay from happening? Or am I missing something easy?
My second question is if the magazine of the weapon is a separate entity to the model, how can I link that to the arm model during the animation? So that left hand takes the magazine out from the weapon model? Is that done through a layer? or can it be achieved more simply with a few lines of code?
I have figured out why the weapon moves towards the left after reloading. It is due to the 2 separate animations (idle/reload) having different positions to each other. So the idle animation is position normally but the reload animation is positioned a bit more to the right which is why it moves back to the left after reloading. Has nothing to do with speed of animation or duration of transition.
If anybody can help me or point me to the right direction with the second question I would appreciate it.
See below for an office hours video. If you want to jump straight to the answer, go to the 5 minute mark
The problem was the transition duration was set to be the length of the reload animation which meant it was lerping from idle animation to reload animation for 2.6 seconds.
The transitions is where it blends between animations. In this case, you want to stay in the reload state for as long as the animation is and then transition back to idle. In which case, you need to set the exit time of the transition back to idle to be end of the reload animation. (It’s a normalised value so it’s 1 or near 1)
Wow thank you for taking time to making the video was very useful for me. I misunderstood the duration as animation duration and not transition duration.
What I mean by the delay type thing is the when the reload animation ends the arms move to the left which makes the animation look unnatural. I can play around with values and resolve this to a minimum but it will always be there.
The reason this happens is because that particular idle animation has a different base location in blender to the reload animation. So they are both in different positions. See the image below that is why the arm moves to the left. The reload is on the left and idle is on the right. They are not in the same position.
I tried moving the animation position in blender but then it breaks the animations and I cannot export it afterwards. Instead I tried using anim layer blending by creating 2 different animation layers using the blend type additive. Here is some improvement but still does not look perfect. I have decided to use another animation instead because that idle animation has a different position.
I also have a few questions when using the state graph:
Can I use exit time with the ANY state in the state graph? I only got the exit time to work when I link animations together individually. When I link to the ANY state I cannot get the exit time to work. So for example I have idle, walk and reload animations. I can use exit time if i connect walk and idle transitions from and to the reload but it does not work when I have them connected from the ANY state.
How does interruption source work? I could not find much detail about that in the materials. Does that mean I can cancel a current animation and play another? so if i shoot i can cancel the currently playing reload animation? I could not get this to work.
I played around more I could not get the animation with the different offset to look good with the other animations but I managed to achieve a perfect animation by blending 2 animations together (additive) and using masking.