Keeping Trace Length Consistent Even When the Spring Arm Adjusts it's Target Arm Length

I am checking out the Third Person Story Template from the Unreal Marketplace and I found an issue with how they go about doing their traces.

Basically they use the Camera’s Location, added to a Trace Forward Offset of 120 and multiply it by the Camera’s Forward Vector to determine the start. They use the Camera’s Location added to a Interaction Distance of 250 and multiply it by the Camera’s Forward Vector to determine the end.

The issue is that if the camera boom (spring arm) shortens due to collision, the start point of the trace, which is based on the camera’s position, will move forward. This results in the trace starting further in front of the player and extending its endpoint further away, causing issues with interaction distances.

I’m attempting to modify the trace setup to ensure that the trace length remains consistent, even when the spring arm adjusts but I just can’t figure it out.

why not just use the actor location instead of the camera location

I did that successfully with the start position (using the head socket of the character) but I wasn’t entirely sure how I could accomplish that with the end point, being as I need the end of the trace to be where the camera is looking.

you still get the direction and length from the camera you just add it to actor.
if you find that to be inaccurate,

you can get the spring arm length and remove it from the interaction distance

1 Like

Anyway you could explain that in Blueprint or show an example? I’m not really sure what you mean by getting the direction and length and adding it to the actor. Do you mean like just tacking a Vector + Vector to the end of the Trace the way it currently is and adding it to the Actor? If not I still thank you, it gives me a direction to go in!

Took me about a week to wrap my head around this but I solved it with your advice of using the direction and length from the camera and adding it to the actor.

Take a look at the blueprint if you’re interested in how I solved it.