I've just started learning UE4, so bear with me. I made a "Better" first person camera if you will by using the Third Person Template (Basically just moving the follow camera into the mesh and parenting it) but I'm having some trouble with it. I'm trying to make a line tracer for an inventory system, it works fundamentally but the line won't go where I point the camera. I've done some testing and I can 100% confirm that it has to do with the third person camera. I'm kinda stuck, any ideas?
What do you feed the Linetrace function as start and end vector? There are different ways to do this. Using “GetWorldLocation” from the FollowCamera as start and “GetWorldLocation + GetForwardVector * 5000” again from the FollowCamera as end works well for my third person character.
If you moved the camera close to your mesh probably even take care to ignore all necessary actors and/or start the line trace a bit further away then “GetWorldLocation” (like GetWorldLocation + GetForwardVector * 300)". I make a further trace with some shorter range to make sure I’m not tracing a wall behind my character by mistake if the camera is “colliding” with the wall when my character crouched below it.
Maybe you could even read this to get a clue:
Probably as a final hint: If you are going to use this line traces in a similar way for spawning projectiles in a third person multiplayer anytime don’t forget to take care that there is a “Always Tick Pose and Refresh Bones” in the Skeleton Mesh Component Details (which is “Always Tick Pose” by default). It could cause some serious headache if you move a client player out of the view of your servers buddy and it’s spawning stuff pretty random close to your character instead at your socket location afterwards. Took me a few months after I figured out that there was nothing wrong with my line traces but the skeleton was only updated when the listening server buddy watched the client character (and rendered and updated the bones only in that case)