How do you implement blend tree animation aiming in a third-person shooter?
Hello. I have created multiple gun aiming animations that I would like to interpolate between by moving the mouse up and down. I have set up a blend tree with the animations, with thresholds of -90, -45, 0, 45, and 90, just like in a video I saw by Royal Skies LLC, but I'm having trouble with the coding part. I tried, "animator.SetFloat("aim", Input.GetAxis("Vertical"));" but the float doesn't seem to be changing when I move the mouse, and thus the animations aren't playing.
Here is the video for anyone who might be interested: (from 1:09 onward is the part that I followed) https://www.youtube.com/watch?v=E8VJ7wm1mcA
Answer by Elsyndur · Dec 08, 2020 at 04:28 AM
So, apparently, "Vertical" is for a gamepad, and "Mouse Y" is what I needed for the mouse. Now, however, the character is snapping back and forth between the desired pose and its forward aim pose while I'm moving the mouse around. How do I get the desired pose to stick?
Okay, I figured it out. I added "float yaw" as a variable, then I replaced "Input.GetAxis("$$anonymous$$ouse Y")" with "yaw", and then, above that line, I put, "yaw -= Input.GetAxis("$$anonymous$$ouse Y");". Now, I just need to get the angle of the camera to match the angle of the gun's line of sight. That should be easy enough.