Rotate player (and camera) to targetted actor

In my project, as you move the mouse (left and right), it rotates the player. This allows the player to strafe left and right, etc.
I’ve been working on creating a lock on funcation to an enemy. I have all of the code working for that, and I can get the player to rotate/face the enemy, which is what I want, but I can’t get the camera to rotate with the player. So the player rotates around the enemy, but the camera doesn’t. I’m trying to get the camera to stay behind the character while the character is locked onto an enemy. Here is what I have right for rotation. Any help/ideas are appreciated, thank you!


2022-12-30 09-59-37.mkv (8.6 MB)

I believe what you are looking for is the Set Control Rotation function accessible via the player controller.

Above you will see an example using the default Third Person Character project where I am increasing the camera rotation by 90 in the yaw every 1 second. I hope this helps :slight_smile:

this worked wonderfully, thank you!!

one additional piece, so this worked great. The one thing I’d like to improve now is; as I move the mouse left and right, it still adjusts the camera and player rotation, it snaps back to the actor i’m locked on to, but I’d like to basically turn off the mouses ability to move the camera left and right, etc. While I’m locked on - do you have any solutions for that?
Thank you for the help!

got this fixed, thank you!

1 Like