UE version: 5.3.1
Basically, the goal is to do this:
be able to toggle from first and third person view using only one camera (tutorials on this topic use two - one for first person, another for third person)
First Person view
Target Arm Length of the camera boom accepts negative values.
So… move the boom. Adjust target offset to taste.
Done.
In my case, I want to be in third person only when I'm holding one specific button. This was my implementation:
Side note, this took me a while to find - I found Set Target Arm Length
by dragging the camera boom node.
BUT!
On First Person POV, I can look straight down and it clips through the character mesh, which is not right.
Set the view pitch min/max by first getting the player camera manager
then set the view pitch here
It'll look something like this
but I found that a bit clunky what I did is to add it at the end
where
Aside:
I added a IsFirstPerson
variable because of reasons that will be useful in a later post
But now I want to make the transition to be smooth, like in the intro
Many thanks to the Unreal Source discord channel for the help on this one: I used the FInterpTo
node to set the length of the camera boom
Code
This will produce a warning if the EventTick
node is already used elsewhere
Troubleshooting
I control the left and right, but not the up and down
Turn on Use Pawn Control Rotation
in the camera boom
Extra
With crouching: