Fixed camera needs to follow character when moving out of frame

Hello everyone,

in my previous post (New camera system | Prevent camera from jumping with character) I tried to create a camera system where the camera stays fixed and doesnt jump with the character.
We managed to solve this in the previous post.
Its important that you read the previous post to understand the issue in this one here

Now the issue is that in certain cases e.g. when character is being launched or double jumps, the character goes out of frame since the camera is fixed on the Z value.
I tried to solve this by adding a toggle to event tick event called “camera follows”

Tge “SetDefaultCameraLocation” node is the functionality from the previous post. This is only being played when “camera follows” is false. If camera follos is true, the camera does behave like it usually does as a default 3rd person camera.

The idea was to toggle this on and off when the distance between the character Z and the camera Z is greater than a certain distance, indicating that the character starts going out of the camera frame.
If thats the case, the camera should follow. The logic for this is inside “Is Character Leaving Camera Frame”

First part:

The “false” part of the branch:

Currently, it looks like this in motion:

As you can see the camera follows the character when it double jumps to keep it inside the frame.

However there are 2 isssues:
The first one being if the character is launched like on the launch pad and lands, the interpolation starts clipping on landing.

The second problem is when the character jumps BEFORE the interpolation on landing finishes, this happens:

What happens in the second issue is that the camera jumps above the character head for a second and goes right back to its previous position. The reason for this is that the default position of the spring arm is right above the head. So I guess theres an interpolation error when the character jumps BEFORE the camera is at its new interpolated location.

This only happens ONCE if the character jumps AFTER landing on a NEW floor

My guess is that this solution is completly wrong and there is another way to make the camera follow the character if it starts going out of frame.
Any ideas?

Thanks for your help,
-Ekveel

In the linked post I saw a timeline in one of the screenshots, have you tried moving that to tick instead?

Not sure if I would use the springarm approach, would probably make a new pawn class that just has a camera in it and use that to follow the player pawn around.

Hi,
the functionality with the timeline is already being called in event tick. The “do once” node is there to ensure that it doesnt fire on every tick to safe performance.

I already tried using a different pawn actor for the camera way before this solution and that one had lots of other issues together with the one from the previous post.

My guess is that the problem here is mainly caused by the timeline and the “cam height” variable not being set correctly when the character is being launched or is double jumping.

This is the character during a double jump at its highest point. As you can see, the red spring arm is way below the character and slightly going up and going back down when the character comes back down.

As you can see the same issue happens when landing after a double jump

As you can see the camera behaves differently when landing the first time after the game has started and when the character does the same thing afterwards.
On the first ever “double jump → land” the camera plays the timeline normally from the old camera height.
However going back down and doing that again the camera doesnt do this.