Cover system improvements
After some feedback from my tutor I have made some improvements to my cover system and camera. Previously the character movement really didn't look right when moving in and out of cover, as the character mesh rotated and moved without any animations to blend these movements together. Since I am not an animator, I have worked around this issue by letting the AI take control of my character, making it run to the shooting position and then back to cover.
To create the new cover mechanic I used a used a similar system to my previous blog post, using the same peek location to make the first AI movement. However the line trace which fired before the movement to determine a return location wouldn't work in this case, as it was a location on the wall rather than a location that could be reached by my AI Navmesh. So to solve this I made a function to set a location based on the character's actual location and the side of the cover used.
I then used this variable using the 'simple move to' function, using the player controller.
Camera blending
As you can see in the above image, I have called a few new camera events based on what is happening to the player. Before aiming down the sight, the player camera is in corner view. This would then switch to 'Peek camera', (which is the player aiming down sight while in the corner shooting position), and then back to the corner view when the player stops aiming. I also added a camera reset to switch it back to the standard view when not in either of these positions.
To allow for smooth camera blending I used timelines on both the camera's offset to the player and the camera boom length, which can be reversed once the movement is complete.
Progress video
(Fraps drops my framerate during recording, it looks a lot smoother during gameplay)
At this point I am behind schedule, I really wanted to be done with both the cover system and shooting mechanics at this point. However it really did need to put in a lot of hours to make this right. I think the cover system looks a lot more polished, with plenty of bugs fixed along the way, which may help me in the long run.