Smooth transition while toggling Use Pawn Control Rotation

Hi there!

**TL;DR - Sorry for the long question. In short, in a First Person game, how can you take away the input from the player to play an animation with some head movement and then smoothly transition the camera back letting the player continue from there? **

The long story, I found myself into quite a situation while dealing with an animation into a First Person project of mine. I have a map in which the player starts by waking up from his desk. Everything looked simple here, I just made an animation for him and right after it played and transitioned back to its idle animation I could let the player continue the journey through the game. The problem is that the animation used has some head movement into it that wasn’t there when I played it, so I thought that I can resolve this by temporarily disabling the “Use Pawn Control Rotation” from the player camera.

336099-ue4-bpquestion.png

Everything works great so far, the only problem is that I can’t quite find a way to smoothly transition when toggling that node in BP, the camera just snaps suddenly into its position when changing the value instead of smoothly going on.

I thought about having a second camera in the character blueprint but something just didn’t feel right about using 2 almost identical cameras for this purpose.

I’ve searched for the past 2 days for an answer, but I can’t seem to find a way to do it. Is there a more proper way to do something like this or am I missing something that can make this transition go smooth?

Thanks for your time! If there is some more information required let me know and I’ll quickly complete everything.

you need to use linear interpolation aka “lerp”, here is a tutorial on how to use it. In the example he is changing colors, but you could do the same for camera location. Drag a pin from the “Follow Camera” node and use a Set Location node with the lerp

I really apreciate you taking your time for this. Thanks! It worked as you said.

I’ve set the player controller rotation using “SetControlRotation” to a given value (X=0, Y=0, Z=90) and after that I’ve got the current camera rotation at the end of the animation and then just made a lerp from that to the controller rotation and enabled “Use Pawn Control Rotation” at the end of the lerp.

Thanks again for your answer! It really helped me out of this one.

1 Like