UE 5.3.2
I have the built-in Base Third Person Unreal Project setup.
The only thing I added in was a Target Lock System.
I followed tutorials for doing a Target Lock System and a lot of them say to do this in Tick:
It seems to work fine, however I notice a weird issue when I change directions.
The target lock gets offset a bit (and then eventually corrects itself) when the movement direction is changed.
I checked my CameraBoom settings and it looks like “Enable Camera Lag” is disabled so that isn’t the source of the problem.
Maybe it’s related to movement (which uses AddMovementInput)?
But how come it works really well when I’m just using my Character’s Actor Location instead of the Camera World Location?
I’ve tried messing with the CameraBoom & FollowCamera’s Tick Group settings but the issue still happens.
I have a workaround where I use my Character’s Actor Location and just add an offset in the Z direction when finding the LookAtRotation but I want to understand why the issue happens when I use the FollowCamera’s Location.
Is there a way to get this to work with the FollowCamera’s Location without getting that offset issue?
Can anyone share some insight on this?
Update*
I tried setting “Orient Rotation To Movement” Off and that seemed to fix the issue.
My guess is the delay in rotation when changing direction is somehow causing the FollowCamera Location to maybe be delayed?
Doesn’t fully make sense to me.
And it’s not an ideal solution since I do want to have the “Orient Rotation To Movement” feature turned on.
Still would be great to understand this better and hoping someone could share some insight on why this is happening.
Thanks! Yes I did try that as a workaround.
However it’d be great to understand why the “Orient Rotation To Movement” is causing the issue.
Because using the FollowCamera Location would be better since the generated LookAtRotation from it would help orient the camera (attached to the Boom) to point towards the Target better.
Hmm I suspect that while your character is doing a U-turn, the camera boom is also trying to do a u-turn around the character. There may be a one-frame lag there between the rotation that you set in Tick, and the internal rotation that happens.
You could try to use a different Tick Group and see if that fixes the problem.
Probably PostPhysics or PostUpdateWork.
However this could have some undesired side effects, unless you have a dedicated class for it…
Alternatively, make sure to decouple the camera from character rotation. In the spring arm component, untick “Inherit Yaw” should do the trick. Also since you’re setting the ControlRotation directly, make sure the spring arm has “Use Pawn Control Rotation” enabled.
I first tried your second suggestion.
I tried unchecking “Inherit Yaw” and making sure the “Use Pawn Control Rotation” was checked but that seemed to make it so that the Yaw didn’t move at all.
I then tried to set the Yaw of the boom itself (instead of through the SetControlRotation) but that caused some weird movement issues where the character wasn’t going in the right direction for some reason and the camera view was flipping.
That seemed really messy to figure out so I tried out your first suggestion.
I created a new Actor Component class and moved the Target Lock logic there and set the Tick Group to PostUpdateWork.
Now I don’t get the weird camera offset issue.
So it does seem like there’s an issue with how the character doing a turn can cause the camera boom to also turn even when it shouldn’t.
Maybe it’s corrected somewhere under the hood eventually.
So doing it in a separate class/component and running its tick afterwards is the way to go.