How to stop the camera from going all the way up the spring arm when the player walks against a wall

Hi all, how can I stop the camera at this point at the spring arm instead of it going all the way to the end, inside my character when walking against a object (wall or something else)?

Thanks :slight_smile:

You’d need to write the logic yourself. The best place to do so would be in the camera manager blueprint which works closely with the player controller:

Overriding the above function gives you access to the Camera View Target - the actor whose camera we’re looking through atm; you can pull data from there and calculate new position when an override is needed.

The location you’re looking for is a Negative Springarm Forward * Springarm Length * .5 + actor location if I’m not mistaken.


Alternatively, you could try a ham-fisted clamp in the player character’s Tick, not sure how well that would work, though.

3 Likes

Where can I find the camera manager blueprint?

Also if I wanted the camera not to go up the spring arm at all, would I do that the same way, or is there a easier way to do that?

Make it in the content browser:

image

And assign it to your player controller:

2 Likes

Should I also make a new player controller? when I click browse to asset nothing happends

Well yes, you need a player controller and a game mode, too. You will them anyway for other things. Essentially, the player controller is already using a default camera manager, but in order to override camera behaviour, you need a new camera manager.

Yeah I had the standard ones from 3rd person template but cant find player controller bp, but made new ones,

So if I wanted the camera not to go up the spring arm at all how would I do that?

You need to mathematically determine the new desired location and rotation of the camera. There is pseudoscript in my post above - did you try it?

im not sure how to get those values

should I do it like this?

As an example:

This would ensure the camera is always 300uus away from the player, behind them - based on the movement direction. Do note that you should override the camera only when needed - the player can easily detect when they get too close to the wall and have the manager take over the camera behaviour for the duration.

The above is not solution to your issue - just a demo of the data flow. To calculate the correct position you’d need much more script. But this could be the start.

1 Like

Also:

Do note that if you script it the way you say, you will push the camera inside the wall. So you would also need script to stop the movement of the player. Or additional logic for the camera manager. Where does the camera go if the player does decide to go all the way up the wall?

1 Like

Is there not a way to still do a collision test?

There is, you sphere trace in the player character, produce the appropriate data and feed it to the camera manager.

Like this is how I want it:

But this is how it is:

Also cant move camera up or down anymore

But this is how it is:

What I posted was not a solution - just an example of how to use it. Your job is now to write script that positions the camera where you want it in case it gets jammed where you don’t want it. And only you know that.

As mentioned above, you’d need a conditional that determines when the normal springarm collision probing is supposed be overridden - you can see me providing a boolean.

What you’re trying to do is somewhat complicated - you are effectively rewriting a big chunk of default camera behaviour, you’ll need to address every single aspect of its movement.


Have you tried looking up tutorials? Admittedly, the camera manager is something hardly anyone ever talks about even though it is the right way to do it. Pretty sure there are other hacks that may work for you.

1 Like

Only found 1 that would make the player invisible instead of the camera inside the player, but not anything like this.

I guess im being stupid lol, the probe size was to big

Sorry for asking so much which I apparently did not need at all
Thanks for your help and time

2 Likes

Using 5.0.3 and camera probe size appears to have no effect at all.