How to reset camera in game by panning?

Hi,
In my project when player moves the mouse or the right joystick camera rotates but if the joystick or the mouse input is none for a while camera resets back to the original position. The trouble I am having is with the panning part I am unable to pan the camera back to its position. I am able to reset the camera but it just teleports back i dont want it. Can someone please help with the blueprint.

The camera is attached to the spring arm and for manual rotation the “use controller rotation” is set true then after a delay of x seconds “use controller rotation” is set to false and camera resets (through teleportation). Blueprint is pawn class.

I tried the timeline to do the required but its not working.

here is the blueprint for teh reset function using timeline.

What is the variable “spring arm rotation”. Would the value of it change because you used “Set relative rotation”?

“spring arm rotation” is the initial rotator value thats being set in the event begin play. The value will change but its teleporting to the new rotation value i need panning to the initial rotation value

Its the rotator value of the spring arm

I’m not sure if I’m understanding you correctly.
If “set relative rotation” could change it, that would mean, it can change while the timeline is happening.
“Cache” it before the timeline starts? Set a it to a variable, and use that variable for the lerp node instead?

What do you mean by “cache” it

like set the value to a variable before timeline starts and use in lerp as said by cloud and test once if it solves the issue

okay …let me try it and get back to you

So I created a temp variable and stored the value before the timeline starts but that doesn’t do anything except rolling the camera one cycle and then nothing. But i watched the values and values are changing to the original rotator values but camera is not doing anything except rolling one cycle. Also, the values that the temp variable is storing are the new rotation values after the spring arm inherited controller rotation and those values if matched with the original or desired values of the spring arm rotator then the angle of the camera does not match so desired result is not possible anyways with these values …my guess is controller rotation and the spring arm rotation before inheriting controller rotation need to be synced in someway so the math can be done. Help me out here please.

Sorry, I’m a bit lost at what you mean.

Id recommend the “move component to” node, this will smoothly move the camera component back to a desired location and rotation

coming back to start, here what exactly is happening while you are doing timeline? as i see that, lerp’s A value is current Roll and B value is of Roll where you want camera to be (like roll and pitch), i hope you are saving the variable like before camera actually turns, set this variable so that we have roll and pitch where we want to go back… and i think you did right? so what exactly is not working? camera won’t rotate back or smoothness is not there or?

Hi so sorry and thank you but it worked the problem was caching of the variable before the timeline starts and spring arm was controlled by pawn controller so the values for that needed to be set and called rather than spring arm. Thanks for all the help

here is the final blueprint

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.