[3P stealth-action] MicroWave

Hi, !

Thank you for your notice, looking over the left shoulder from a corner can became really annoying. Toggling Y-offset of the camera is a quick-and-dirty solution, but should the player deal with the imperfection of the game? The solution should be automatic: when the player presses against a wall, the camera should toggle the Y-offset automatically, depending on whether a corner is right or left. It could be done using raycasts and simple geometry.

If you browse the code, you can see that my camera is attached to USpringArmComponent. It allows to automatically adjust the arm length depending on where the arm intersects geometry. But once you press against a wall and try to look from the wall, you face a problem - camera looks inside character’s mesh. I thought about a key that toggles 1P and 3P view, but for the same reason as above, I decided to do it automatically: when the arm’s length becames too short, the camera attaches to another spring arm, which imitates 1P view. Once 3P spring arm is long enough, the camera goes back.

I noticed a little danger in your code. Comparing two floats with operator == is potential bug, because the variable Camera->RelativeLocation.Y by any reason could became slightly different from CameraSideY and you will never meet the condition. Use FMath::IsNearlyEqual() instead (if you didn’t know about that, of course…).

Thank you again and keep reviewing :wink: