Camera/Spring Arm inverts when I rotate to look straight up or down

I am making a controller for an aircraft and am having issues with the camera/spring arm rotation.

Initially I just set roll to 0 so it would follow the aircrafts rotation, but I wanted to make it so it would instead orient itself to the horizon so if the aircraft is tilted the camera would stay more or less level and not disorient the player. However here is where I ran into a problem.

If I ever just set the relative roll rotation of the spring arm to be set to its present roll rotation from the start of that tick (with or without adding my own modifiers or anything) then when I move the mouse so that I look down and would then have an inverted camera normally looking behind my actor (or if I look up) then when I hit the point that the camera/spring arm goes from being upside down to right side up the problem sometimes occurs.

About one in four times it does what I want it to do like it did when I just set roll to 0, and the camera continues to rotate as it was with no sudden rotations or changes. The rest of the time when I hit this point however my controls and camera suddenly invert, resulting in the camera rotating so as to be upward facing the instant it hits that transition point, at the same time my inputs are now moving it down instead of up and up instead of down (relative to the perceived view).

As an example, working how I want if I start moving my mouse to look down and keep moving it the camera/spring arm will end up looking behind the actor, albiet upside down since it’s like having bent your own head down to look between your legs if you will.
When it acts like I don’t want I start looking down and suddenly upon hitting that look straight down (or up) point my head would snap 180 degrees so that its up is the same as the grounds/worlds up. The problem is this means my continues input to look down is now resulting in upward input as far as I the user am concerned, and this is undesirable.

The part that this issue only happens sometimes is particularly annoying as I can’t just put in a manual rotate camera 180 degrees when I reach a given point to correct this manually.

I looked for any auto orient upwards settings on the camera and spring arm but didn’t find anything that seemed to help. Also did some searches online but didn’t find anything that seemed like my particular issue. In advance thanks for your time reading this and I hope you have a good!

Hey (this might be a bit late, but this is for anyone else having this problem),

The solution is to clamp the Pitch of the Spring Arm constantly between values of -90 or above, and 90 or below, like so:


However, in most cases, if the player aggressively moves the mouse, they will be able to still invert it, which is why you want to set it to something like 75, so that there is a lot of dead zone where the player can’t push past. Hopefully there will be an option to disable Spring Arm inversion soon.

I tried it out but fortunately it did not eliminate the issue of the random inversion of the spring arm, since it’s tied to the roll, it can still flip around. And it still did it only some of the time, without a clearly identifiable cause for it’s inconsistent behavior…

While your method can work for helping to lock the camera in during simply looking around, the problem was that I was using it with an auto orient to keep spring arm facing upwards so the X axis would be adjusted so even as the actor bobs around when bumped the camera was level with the world. The problem was that when flipped upside down the spring arm would not simply end upside down (I was ok with that), but rather that it would (at random about one in four times) invert the spring arm and thus controls relative to the cameras orientation (the camera would maintain the wanted orientation though thanks to the auto stabilization adjusting the roll, it would just end up resulting int he inputs being the problem).

So while I thank you for the answer and time, and for some people searching with similar tags do to at heir own problems it may help,for the specific issues I was (and still am) having it is unfortunately not a fix.

Ah, I believe constantly clamping the roll could possibly work.

Unfortunately clamping the roll to -180 through 180, -179 through 179, or any such number does not stop the core issue of it randomly inverting control input some of the time, while also leading to some unwanted side effects should it be less than the -180 to 180 area.

I’ve had it on my list to make a visual showing current mouse inputs on the screen so I can record some footage of it to clearly show the problem and make a bug report but I’ve been putting it off do to other things I’ve been working on.

Hey ,

Have you solved your problem? Maybe you could share a solution. Would be much appreciated.
I have the same issue… Clamping isn’t helpful…

Thanks

K