Context: First Person Shooter camera crouching / uncrouching common issues with solution.
I’ve been playing around a lot with the built-in Crouch/Uncrouch functions, and how they relate to Capsule Half Height, Capsule Radius, Crouched Half Height, as well as the Camera location.
In the end it seems like this was designed to work best when you center your mesh as much as possible within the Capsule, especially in regards to height. Otherwise when you crouch, your camera just does not go down far enough to still be within the capsule half height and not clip through a low ceiling area you might be crouching through. However I think people expect the Camera to be towards the top of the Capsule in a FPS.
This leads people to endlessly adjusting the properties mentioned above, soon realizing half of their adjustments weren’t working because the Half-height is limited by the Capsule Radius, but also making a radius too wide makes the character fatter than intended, and lowering your Camera makes your character too short when standing.
It seems impossible to get the perfect mix of values until you find that you can manually adjust the camera location on Crouch/Uncrouch. It only works until you Uncrouch underneath a low ceiling and your camera goes back to the standing location, but your mesh is still stuck down there. Then people start going down a rabbit hole of how to detect if they are in this scenario so they can only adjust the camera after standing, start using sphere collisions, etc, etc.
People’s expectations are warranted here when they load up the UE 5.4 FIrstPerson starter template and see the Arms Mesh pushed to the very back of a rather wide Capsule, and the height of the Camera is towards the top where you would expect the eyes to be.
TLDR: Anyways I guess that’s the end of my rant. Here is my simple solution which is basically the same solution of adjusting the location of the camera, but instead of after the Crouch and Uncrouch functions, through the Event OnStartCrouch and Event OnEndCrouch (Which unlike the input action Crouch completed, this happens after you are actually not crouching anymore).
I also moved my mesh into the very center of the Capsule (horizontally), only accounting for the arms and hands to be within the capsule, and not the extent of any weapon it might be holding.
Currently looking into a solution to always show the arms/weapons even when clipping through walls (Like Overwatch 2 does, which also solves being close to walls clipping issue).
Hope that helps someone, thanks.
- Anatolio