I’m working on a third-person project and trying to smoothly rotate the player’s camera to match the rotation of an actor in the scene. The idea is to trigger this through a widget button or event, smoothly interpolating the camera using a timeline and lerp.
What I’ve Done So Far:
I created a function that gets the actor’s rotation using (Get Actor Rotation) and sets the player’s control rotation with (Set Control Rotation).
The timeline handles the interpolation between the current camera rotation and the target actor’s rotation.
I connected (Get Player Character → Get Controller) to the (Target) on Set Control Rotation.
how to set The timeline outputs to Lerp (Rotator), blending between the current and target rotations or is there another way to do it ?
Additional Info:
I enabled Camera Lag
on the character’s camera, which works great for movement, but I’m not sure if it has smme effect on the camera rotation during this process.
I’ll attach an image of my blueprint for more context.
Would appreciate any advice or suggestions to ensure smooth camera blending!
With this, the camera would face the target actor, not the target actor’s rotation, which is what I think you meant. Though if your objective is to get the camera to face towards where the target actor is looking, you can simply plug the target actor’s rotation into the B pin of the Lerp node instead of the Find Look at Rotation node like this:
(Again, you can change the Find Look at Rotation node in the approach above with the target actor’s rotation and plug it’s z component into the Lerp node instead, if you want to rotate the camera to where the target actor is looking)
Here are the results for each method for a visual demonstration of what each one do:
The first one:
The second one:
The extra one:
And here’s the timeline that I used for all of them:
Thank you so much for the help with the rotation lerp solution
I was wondering if you cou;d help me take it a step further. I tried combining the rotation lerp with a (Teleport) or (Set Actor Location) node to move the player to a new location while smoothly rotating the camera. However, when I do this, the controller seems to rotate unpredictably, and the camera jumps around.
Would you mind trying to combine the teleport or location change with the rotation lerp to see if you encounter the same issue? I’d really appreciate your insight on how to handle both the teleport and camera smoothly at the same time.
If you picked one of the methods where we use the Find Look at Rotation node, I think it’s because the location values get updated for the duration of the timeline, and that causes that stuttering you’re talking about.
I can come up with something for your follow up question tomorrow, because I just shut down my PC.
The camera doesn’t stutter even when trying to move the mouse against the target rotation. Enabling / disabling camera lag doesn’t change the result as well, as I stated before, it’s not related to this specific task anyway.
Though instead of constantly setting the character’s location, I’d recommend adding movement input like this:
If you want to have precise control over where the character will end up at the end of the movement without getting into math, you can create a spline and temporarily restrict the character’s movement to it.
Thanks so much for checking back in—it really means a lot!
I wanted to share an update on my progress. I ended up finding a solution that worked for me: I reset the player’s controller first and then rotated the controller to the desired rotation. It might not be the most ideal or elegant solution, but it did the trick for now!
I’m still learning and figuring things out as I go, so your original advice was incredibly helpful in guiding me. Thank you again for taking the time to help, it really made a difference!
Looking forward to learning even more from this awesome community.