How to smoothly reset camera position without use of "SetControlRotation"

Alpha must go from 0 to 1, where 0 represents A and 1 represents B, so you can’t use World Delta Seconds there. If you want to use Ease, you’re going to need a Timeline with a Curve that goes from 0 to 1.

If you don’t want to use a Timeline, try Rinterp instead of Ease. That runs on World Delta Seconds.

Try disabling the camera rotation control with mouse/movement until the camera is reset. For example, if you use a Timeline, when you press the reset key, set a cutom bool variable to False, and when the Timeline has finished playing, set it back to True. And add a branch between the mouse input (or whatever keeps moving the camera) with that bool variable. If you make a Timeline length about 1 second, which is quite enough to reset the camera position with a decent degree of smoothness, you can easily disable the camera rotation by anything else than the Timeline, and it won’t adversely affect the player experience.

Edit: another thing: your setup seems to work because you don’t save the initial rotation to a variable before starting to reset the angle, but that doesn’t in fact work as you’d like, because the rotation never actually reaches the target angle, it just gets closer and closer, because for every iteration you take the current angle and value A. And therefore your reset rotation never actually finishes.

I really suggest using a Timeline, saving the rotation to a variable before starting to reset the camera position, and working with the Ease node where value A is that initial rotation variabe, value B is the target rotation variable, and with the Timeline curve as Alpha. Maybe in this case you won’t even have to disable rotation caused by movement, but you’ll have to check that.

Sorry, what I meant by “initial” is current camera rotation at the moment when you start the reset. You get it when you press the reset key. And the target rotation is the character rotation, the arrow works just fine.

Hi, this is something I have been struggling with for quite some time now. I’m creating a third person game where I would like to have the ability to freely move the camera around the player (ie GTA V) and then with a button press reset the camera to its starting position, blending with (ease) from point A to point B.
I have achieved this by following this video tutorial: Unreal Engine 4 Reset Camera to Default Position- Third Person Style - YouTube

My issue is that this way of resetting the camera position ends in “SetControlRotation”. So if I hit the assigned reset button while the player is moving left or right the camera will spin continuously until the player has stopped moving. I think this is because moving the player left or right also sets the control rotation, thus they are fighting one another.
If I could smoothly reset the camera is some other fashion I could then “SetControlRotation” after the player has stopped. This was the camera could rest smoothly behind the back and the player could continue in its left or right direction, only updating the control direction once all movement had ended.

I’ve tried everything I can think of and I’m dead-ended on this. Please check out the video my BP is based on that and I will also make a capture. Sorry for the long winded question, I’ve asked about this elsewhere with not much result. Thanks for any help!

Thanks but that’s not the problem, this setup does reset the camera, I just need some other way of smoothly doing so without “SetControlRotation” because if the player moves while resetting the camera will keep spinning.

Thank I’ll give it a shot I’ve tried once before by getting the camera rotation (A) at Begin play but I don’t know exactly how I would get the cameras target rotation (B) that’s why I’m using player forward arrow. How would I do so? Also, is event begin play to getworldrotation (camera) a good way to grab the cameras initial rotation?

Ok I did that and added the timeline but I’m still getting the spinout issue when resting while the player is turning left or right.

What I meant by initial is the current camera rotation at the moment when you press the reset key. The target is the character rotation, you’re right about that.

I gave it some more thought and realized I’ve mislead you, sorry about that. The Timeline won’t work right if your player turns during the timeline.

You can try using Ease as you intended from the very beginning, but what I think you should do is after the Set Camera Rotation — check if the difference between the current camera angle and the target angle is less than a certain threshold, like 3-5 degrees, and when it is, close the Gate (unfortunately I can’t see what’s after the Set Control Rotation in your blueprint — by the way, why are you using Control Rotation, not Camera Rotation?). The thing is, as I mentioned earlier, the angle never reaches the target angle, and I don’t know exactly when you close the Gate and stop executing the Set Rotation command.

Okay well after the Set control I had a delay the length of the blend that then closed the gate. But with the timeline in place, I don’t seem to need the delay. I’m using Set control rotation because that’s the only thing that properly moved the camera in the way it is meant to. If there’s a better way I’ll try it umm I also tried setworldrotation as well as setrelativerotation (just to test to see what happens) on the camera itself but all that does is move it to an awful position.

Got it. I thought some more (which is quite difficult with no engine at hand) and came to a conclusion that a Timeline should work as long as you save Current Rotation to a variable, but use the Character Rotation as B without saving it to a variable. Thus even if you rotate the Character in the process of TImeline work, it wil just speed up/slow down the rotation offset, but the camera should be exactly where you want it at the end of the Timeline.

And you won’t need any Gate or Tick (or Timer, whatever you use for the Gate Enter pin). So you only have to Play the Timeline once when reset key is pressed.

Another thing, how does the camera normally rotate? How does it depend on the Character movement or keyboard/mouse input?

Ok I already have the Current rotation saved into A and I’m already using Characters Rotation into B, but that doesn’t seem to work speedup/slow down the rotation offset like you mention (not sure what I’m missing there). I’m using a gate because it’s set from a tick to check if the Controller rotation and players world rotation are not within 2 degrees of each other then the gate is open to reset at button press. The camera rotates by using the mouse or right stick on control. I could be wrong but I really feel like the Set control rotation that resets the camera is fighting with the players left and right movement (A/D on keyboard) and that is why the camera can not reach its destination. but if that is the case I have no other way to move the camera in the same way without messing with control rotation. Hope that makes sense.

Okay, I tried to recreate your setup and I think I know what the actual issue is. The thing is, when you start resetting the camera rotation and the Character is still rotating, at some moment it might happen that the opposite direction becomes the shortest one, and the camera shakes and jitters, and having the Shortest Path on Ease on or off doesn’t make any difference.

How to deal with that… I can’t tell you now. But I’ll be definitely thinking about is a lot more. If you happen ti find the solution, please do write it here. I’ll do that too, if any.

I’m stumped for now as well so, for the time being, I have the game set up to have the camera follower the player when the player is moving (like a Zelda or Mario 64 camera) and if the player is standing still you can then reset with the Ease as long as the player isn’t moving. This would be good enough for now but I’m stuck on something. I need to be able to reset the camera position after a button press while the camera is moving, I’d like to Ease but it doesn’t have to if I can’t get it. The reason this is so important is that if the player is running toward the camera and unable to reset camera position whilst moving, the player could potentially run head first into enemies or other hazards…

Ok So I tried this what you have, I was a bit confused because like you said my camera is attached to the player so I can’t use SetActorWorld so I used SetWorldRotation. This way of doing does rotate the came in the right direction but does not move the camera to the correct location behind the players back (does yours?). I tried setworldlocation of the camera’s location to the location of a box (attached to the player) set in place to act as a position of where the camera should end up. This kinda moves it but often next to the box and depending on the angle the camera was reset from it can also screw up the roll. I have no idea : (

After doing some thinking, I came up with this:

Basically the idea is that upon pressing the reset key you snap the Camera Rotation to the Character Rotation (in my case it’s Attach Actor, but in your case I believe the Camera is already attached to the Character, so you only have to lock its rotation relative to the Character), and then you execute the resetting sequence.

The value in the Alpha controls the rotation rate, you can play with that to reach the desired effect. The branch condition sets the threshold angle value that stops the rotation. After the rotation is stopped, you unlock the Camera Rotation from the Character Rotation again.

The Timer represents a tick. I set it to fire 50 times a second, because Event Tick frequency may change, but the Timer is more stable (provided that your fps is higher than the timer fire rate).

One drawback is that the rotation rate is not constant, it starts fast and slows down, but maybe that’s an advantage, depends.

Don’t mind the names ans the rotation nodes, I actually did it all with just cubes, you can rotate the camera using the controller as you used to; what I wanted to show is just the math and the attachment/detachment part.

Your camera is attached to the Character, but as I understood the Camera Rotation is independent of the Character Rotation, is that right?

If we set everything else aside, is there a way to lock the Camera Rotation to the Character as it is at the current moment of time? Like, foe example, the Camera look to the right side of the Character, and when you lock it, no matter how the Character moves, the Camera always stays at the same side of the Character?

Yes, the camera rotation is indeed independent of character rotation. I’m not sure but why would I need to lock the cameras current rotation (the place where the camera is just before reset if I’m understanding you correctly).

I don’t understand, my camera is already child to my players mesh.

I set up the attach but that just makes it so I can no longer move the camera freely. I should be able to move the camera around and for example, if the player is running toward the camera/hit reset button and the camera goes behind the back.