I’m currently messing around with the ShooterDemo provided with Unreal Engine. I’m currently trying to implement a crouching feature. While I’m currently able to get the player to crouch correctly, the 1P Mesh (Arms and weapon) doesn’t move to the correct position vertically (seen in the picture below).
After looking through the OnCameraUpdate function in ShooterCharacter.cpp, it seems like the 1P Mesh should be moved to the correctly location relative to the camera regardless of the camera’s vertical position. After looking at the player in the 3rd person perspective in the editor (shown in the pictures below) the 1P Mesh can be seen moving down when the player crouches, but not enough to correctly align it with the camera.
I’m having a hard time figuring out what is causing the 1P mesh to not be kept in the correct vertical orientation relative to camera when crouching especially when it works perfectly when standing.
I ended up getting a bit closer to solving this by moving the 1P Mesh’s relative position down in the Z direction by a fixed offset when the player is crouching. As soon as the player started to look around though the 1P Mesh was not correctly aligned. I think there needs to be some simple vector math to translate the 1p mesh to the right position rather than just moving it down on the z axis. Any help would be greatly appreciated!