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?
asked Mar 24 '15 at 10:13 PM in Blueprint Scripting
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.
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.
answered Oct 01 '15 at 04:51 AM
I know it's an old thread, but if you still have a picture of this, I'd love to see it! Cheers!
answered Jun 24 '16 at 04:03 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here