How would I make the camera in top-down rotate to follow the mouse cursor on right-click?

Hi there!

New to UE development and trying to get my feet wet with blueprints. I’m trying to make

A) The camera rotate to follow the mouse cursor when right-click on the mouse is pressed. I’ve read a few posts from the past, but they seem to be outdated now. Note: I do not want the camera to move to the cursor, but to angle towards it.

B) Have my player character’s front face the mouse cursor at all times. I have movement set to WASD, but I’d like my character to face where the player is “aiming”.

Thanks,
TheMrYesac

Hello! @TheMrYesac !

If you want the camera rotates only when the right mouse button is pressed.
You can follow this steps.

I create this images from the blueprint Third person template

1 - Create a new Action Input (you can duplicate the IA_Jump)
2 - Be sure you have the trigger in pressed and released
3 - Add your new action input in the IMC_Default

4 - In the character start listening the new Input Action. Create a new variable called Look Input Pressed. When the input action is triggerd set this new variable.

5 - Look for the event called IA_Look. Add a branch node and check for the value of or new variable to modify (or not) the controller Yaw/Pitch Input

Hi BRGJBengoa! Thanks for the quick response. I mistakenly wrote “Third person” even though I meant top-down. I was following your instructions, but couldn’t find IA_Look, and that’s when I found my mistake. Sorry!

To rotate the camera toward the mouse cursor when right-clicking, use “Get Hit Result Under Cursor” and rotate the camera gradually using interpolation. For the character to always face the cursor, calculate the direction using “Find Look at Rotation” and apply it to the character’s yaw. While experimenting with input responsiveness, I used mycpstest.fr to check how accurately and quickly I was clicking—helped fine-tune the control feel a bit.