Was having this issue a long time ago and ran into it again and wasn’t able to word my question in a way that found me an answer.
I have/want a line trace originating from my capsule location towards where the camera is looking. But whenever the character changes direction on movement input, the camera forward vector seems to shift for a second before returning to where the camera is actually looking, causing it to be inaccurate on turning.
It helps if you compute the trace from one place, you’re using two.
So, just camera would be fine, but I see you want it from the player.
I’m not sure without checking if the TPC capsule faces the direction or transit or not. You could try from the capsule, or from the actor, or the character mesh etc.
EDIT: I just checked, the capsule rotates with the player, so you can trace from there
I’m not sure the origin really matters, but I believe I did try basing everything off the camera and the issue is still the same.
The actual issue being that when the character changes direction with the wasd keys, the camera forward vector changes for a second and returns back to normal, even though the camera view itself does not change direction, and even without any mouse input.
In the last gif you can see I am printing the value of the camera fv, it changes even though I am not rotating the camera at all.
I see someone “fixed” it by turning the character movement turn rate Z to 0, or by disabling orient to movement but that stops the character turning to where they are moving which is undesirable.
I’ll post a GIF of it still happening with the camera as the origin when I’m home.
Now the origin is the camera world location and the end point is based on the camera entirely.
Still seems to be the same issue where the camera forward vector is changing momentarily when turning the character around but the screen isn’t actually rotating.
The event tick is in the third person character bp, I will try f8 when I get back on but I think the line trace is maybe distracting from the actual source of the issue which is why would the camera forward vector change for a moment and go back without mouse input or actual camera rotation at all when the character changes direction.
I noticed the change to the camera forward vector is also influenced by the direction which the character is turned relative to its old direction.
@pezzott1 using f8, it seems I just unpossess the pawn. I unhid the camera in the thirdperson character bp and saw that the line was definitely starting at the follow camera’s position (the one in the thirdpersoncharacter bp), however I couldn’t turn the character when unpossessed so hard to test the issue.
@Rev0verDrive Wow, using that instead works! I wonder why the follow camera’s forward vector shifts while the player character is changing direction and the camera rotation from the camera manager doesn’t? I feel a lot of tutorials probably do it the way I was doing it before, is it supposed to be that way?
Thanks a lot though Rev, and everyone else too.
Final solution with using the forward vector of the camera rotation from the camera manager: