Change Spring Arm angle not length on collision

issue I’m running into is I would like to have spring arm on “collision” check not to change its length but to just rotate to compensate for collision. Then once player moves away from collision it should return to default spring arm angle I have defined. Here is a picture illustrating what I’m talking about. I cant seem to get spring arm from changing its length. Any insight would be great!

I think you have to do your own spring arm with this.

Yeah I wasn’t sure if I could locked that some how in blueprints. For now I have a temp solution of changing angle before it ever can collide with any walls by using trigger volumes around base, but its definitely not most flexible system.

Can you share your workaround on this issue?
I have similar issue with spring arm camera but it happened when it hits ground, then arm get shorter and ended up clipping pawn :frowning:
Thanks in advance.

~R

Hey,

You might consider using a couple of Line Traces instead of collision detection. I created a basic setup using line traces that works pretty well for me, though it is certainly not perfect and could be improved upon.

Here’s Components tab of MyCharacter BP:

Pretty standard, except I added a small Sphere component and named it CameraCollision, then attached it to Camera and moved it down a bit.

Here’s Event Graph:

First, we set a Rotation variable based on Camera Boom’s World Rotation. This gives us an angle to return to when nothing is blocking trace.

Then we perform our first trace, a Single Line Trace by Channel, with Start Location of Camera and an End Location of Mesh component. If trace hits something, we rotate Camera Boom by 1 in Pitch. It will continue doing this per Tick until nothing is blocking it. This may need some additional clamping if you have a ceiling, etc.

If first trace doesn’t hit anything, it performs a second trace between slightly lower CameraCollision component we created earlier and Mesh. This second trace is giving us a bit of a cushion before returning rotation to its initial position, so it doesn’t jitter wildly between rotating up and rotating down.

Once second trace is also returning false, we start rotating Camera Boom back down to its initial rotation.

There’s still some jitter with this set up that can probably be cleared up with some adjustments to rotation speeds and positioning of components, but you get general idea.

Hope this helps!