Reducing erratic camera collision behavior

As mentioned in the title above and illustrated in the .gif below, I’m having some issues with the default spring arm behavior. I’m trying to minimize the ‘jump cuts’ and erratic movement whenever the spring arm detects a collision, but I can’t come up with a solid solution.

What I’m mainly trying to achieve (and what you can see on the right side of the gif above) is for the camera to back out slowly after a collision, instead of jumping straight to the maximum “target arm length” of the spring arm. The most promising solution I could come up with is the following:

  1. Run a sphere trace with a radius that’s slightly larger than the probe size of the spring arm
  2. If true, set the “target arm length” to the current distance between camera and spring arm.
  3. If false, slowly interpolate back to the default arm length.

This works perfectly when standing still and rotating the camera, but it doesn’t work at all during movement. The problem comes in at step 2: Due to the spring arm’s camera lag, the distance between camera and spring arm does not equal the actual arm length and somehow produces the jittering illustrated in the gif below. I’ve tried calculating the new target arm length in a number of different ways, but couldn’t figure how to work around the jitter. If I disable the camera lag of the spring arm, everything is working as it should, but that’s just trading one problem for another.

I’ve tried several different approaches to reduce these kinds of camera jumps, but nothing really worked. If anyone can offer any kind of help with this - be it a solution for the jittering issue or a different approach altogether - I’d be super grateful!

Sample project download (21MB)

Sorry for the bump, but I’m still stuck on this. Does anyone have any ideas?

One more bump since this is still bugging me and I can’t figure out what else I could try.
Any help would be appreciated!

I do believe ive come up with a solution - i found the jitter cause, just break the hit result and plug in the distance to a print string and youll see that it equals zero when the camera gets close to the player. Basically the trace doesnt do anything at some points so the logic fails. But - i did this and it seems to work pretty well. Probably isnt perfect but its better than the camera popping in and out. It still very slightly shaky on the transition but maybe with some more fiddling it can be eliminated.

Were you ever able to figure this out? I don’t want to dive too deep into complex code in order to achieve this, but it looks like I’ll have to eventually.

I managed to fix it this way. The main problem was the sphere cast length. Instead of casting it to the camera, you cast it towards it, but at the same length as the maximum arm length. It’s silky smooth right now, give it a try!

1 Like

I know this was a very long time ago, but you don’t reckon you could help me out if you found a solution. Game finished, but really don’t want to release it with a scummy camera. Thanks.

Just stumbled across this and very much need it to be solved, any chance you can send a sample project as l can’t get it working, thanks