Switching use pawn control rotation on off jerks the camera

Hey everyone!
In my game, I have flying, and you can go back and forth between it and walking. When you fly, use pawn control rotation is turned off to lock the camera to the player, so that they rotate together. It turns back on when you walk.

The issue is that when you start flying(turn off pawn control rotation), it seems to remember the yaw rotation from right at that point, cause if you turn at all during flight, then stop flying and start walking (turn on pawn control rotation) the camera jerks back to where it was when you were walking before the flight. so basically, when you turn in flight, you can expect the camera to move back to where it was previously, disorienting the player.

I had a little fix temporarily that basically just readjusted the camera to the mesh direction, but you could see it jerk for a moment before adjusting in the right direction. I’m worried that this is just in the nature of use pawn control rotation. Is there a better option or a way to turn that off?

Thanks!

I’m currently using a setup that uses multiple cameras for one character. Depending on what the character is doing, the players view can be switched between both cameras. I have it set up almost like you do here, I am also toggling the “Use Pawn Control Rotation” option. Both of my cameras are set up on spring arm components and one of the cameras does use the pawn control rotation feature. I was also unsuccessful at changing or setting the rotation of the spring arm as long as it was receiving controls from a player. As soon as “Use Pawn Control Rotation” was re-toggled or turned back on within the spring arm, it seemed to remember the last rotation it was at before the feature was turned off. This creates a similar camera “jerk” much like the one you’re describing.

I personally found the “Set Control Rotation” node to be the solution to my problem. I can’t completely explain why it works, but I’m pretty sure it has to do with the spring arm rotation being based off of player input. which is probably why using set world rotation nodes wont work unless the feature is turned off.

Heres what it looks like in the editor. It’s much easier to find if you right click and search for “Get Controller” first then drag out the return value and search again for “Set Control Rotation”.

I got the rotation of my other camera and plugged it into the “Set Control Rotation” node. It seems to work alright, but at times I’ll still notice a quick jitter from the cameras transition. I fixed that by simply setting the control rotation along with the other camera on event tick. Both my cameras rotations are pretty much the same until I change them and the player regains control of the camera after re-enabling “Use Pawn Control Rotation”.

Also, I didn’t set any sort of target for the camera or anything. I literally just plugged in a rotation value and triggered the node whenever I needed it. Then it just started working lol. I just assume that it takes the currently controlled camera and applied the rotation to it. I’ll have to take some time sooner or later to better understand how this node actually works.

I hope this helped somehow, best of luck to you on your project.

tl;dr

If you’re camera boom is inheriting controls from the player using the “Use Pawn Control Rotation” option and you want to change or set a rotation value for it, try using the “Set Control Rotation” node, it might work.

1 Like

Hey man! thanks! this is old, and I found a solution myself but thanks anyways. I actually had been using control rotation, but I think the way I had it set up it actually the problem was the order it would turn of use pawn control rot and set control rot. Anyways I ended up having a setup on event tick that would update the camera ever frame to be behind the character when a bool was true. If you or anyone ever wants to see this I can link a picture.

Thanks again!

Hey JakeD!

I know it’s an old thread, but if you still have a picture of this, I’d love to see it! Cheers!

Hey JakeD!

I know it’s an old thread, but if you still have a picture of this, I’d love to see it! Cheers!

sorry I’m not Jake, but I still feel compelled to reply. Even if this thread is dated haha

I mentioned I was also using a multiple camera setup in my project. It honestly sounds much like Jake’s rig. I uploaded a picture showing the kind of system Ive been playing with.I actually learned this method in a different discussion. I’d gladly supply a link, but I have no idea how to find where I found it, lol sorry (again).

I’ll try to tell you what I know about this little piece of blueprint though. It’s just a Boolean that changes the active camera. The first “Set Active” node turns off the current camera, while the next node simply enables the second camera. Note the little check boxes on the nodes, that’s where the magic happens. You’re essentially turning off one camera, and then turning on another. easy as that.

You can also continue using additional events after the last “Set Active” nodes. So if you wanted to “get” and then “set” a rotation for a “Set Control Rotation” node, its very possible to do any of this after changing your cameras active status. Or before, if you need or want too.

A small warning to this sort of setup before I’m done. It’s not very efficient, to be honest. Every single tick in your game will be checking the current state of your cameras. basically always turning off the undesired camera, and always turning on the desired camera. I would advise playing around with this more before deciding to use it in any sort of serious project. By my understanding, abusing the “Even Tick” node can actually lead to performance issues. I’ve not yet reached that point, but its something I always try to think about, haha

I feel like, Ive said way too much lol. I’m not really sure what you’re trying to accomplish or what you might be having trouble with, but i hope this picture helps you somehow. I’m more than willing to answer any questions you might have.

best of luck to you on your project!

Hey m_biss! Sorry for the late response. The day you asked I was on my way to work, planning to respond when I found the time, then it poofed away from my mind haha.

As I had said, the solution involved updating the camera every frame so that it wouldn’t jerk at all. It also only uses one camera, if that’s what you’re going for, otherwise Stickman’s solution would probably work for you.

Otherwise, this is my solution.
96285-

Hey Stickman!

I actually responded with my setup as well in case he wants the option between the two, or if you want to see how I avoided the jerking with one camera. I didn’t even realize it was you who responded again all this time later haha. Thanks again for helping out!