I’m working on getting a transition when switching weapons on a FPS game.
I’m playing the following animations: hide arm → Spawn gun → show arms
There is always 1 frame at the end of an animation where the gun can be seen at the wrong location.
do you have any idea how I can solve this?
That is very sad to hear… I’ll try digging deeper. When playing the animations very slow, and increase blend time, I managed to get an idea of the problem source. I’ll try some ideas tonight.
Up to now, I found two ways to remove these frames.
Making a montage with 2 animations, and use Notify to do stuff that needs to be done between the animations (like spawn a new gun mesh)
Use a State Machine, and call from the interface some actions to blend the current animation. Currently, I switch from Idle → lower arms → raise arms
The problem with the first one is that I need to create an animation for each possible combination ( From pistol to rifle, from pistol to shotgun, from rifle to sniper, etc) Not the ideal…
The problem with the second solution is that I currently think it is not possible to wait for an animation to finish, or receive a notification for the state machine. So getting the right timing to hide the pistol and spawn the rifle is a matter of tuning a delay to the right value.
I think I’m getting to understand what’s happening. Once a montage is over (On completed), and you call another one, there might be other things happening between these two calls, where the animation is trying to return to its idle state before the second montage is fired. This is the “weird frame” I’m talking about.
By using Anim Notify on the end of my first animation (1 or 2 frames before it ends), I can call a “On Notify Begin” to do the following stuff, up to the second “Play Montage”. I feel like using these 1 or 2 frames as a buffer let the animation continue while other things are being processed, thus not leaving any room for the “idle state” to show for a frame.
It’s also possible to push the animation end time further, keeping more frames as buffer, if needed.
To be honest, I haven’t worked on this project for quite a while. This is one of many problems the creator ignored, and at some point, I got tired and moved to a better structured and planned tutorial.