[3rd person template] How to Rotate the camera with Righ click while keeping the cursor in the place it was clicked

Hello everyone,

I’ve been digging around to be able to make a camera rotation while keeping the mouse cursor visible. I was able to hide/show the mouse cursor depending on if both left and right mouse buttons are pressed or not.

However, I’m struggling with the fact that when I enable “show mouse cursor”, the rotation stops when the mouse cursor hits the boundaries of the screen and the rotation itself is slow and doesn’t give much of a good experience.

What I’ve noticed is that when I play the 3rd person template out of the box, the camera rotation is seamless, exactly what I want…but whenever I turn ON the “Show mouse cursor” I face the above issues… not sure if I’m clear or not, but in essence I want to be able to have the same Camera rotation behavior of the 3rd person template but with the mouse cursor visible. Anything I’m missing here?

PS.: I have also tried to fiddle with the “Turn Rate” variable of the template…but it doesn’t seem to improve on anything :expressionless:

Ok so, I think I’ve solved this by setting a “Set Input Mode to Game and UI” node before I set show cursor to True and Set Input Game Only after I set Show Cursor to false. Behaving just like I wanted. I’ll keep running some more tests to see if this holds.

P.S.: I have followed this answer to get to this result.

Yep, I’ve got that. The problem was that everytime the Show Cursor was on, the mouse was “clipped” to the viewport boundaries hence making the rotation stop.
What I’m actually doing is that if I have LEFT+RIGHT mouse button pressed, I hide the cursor and make the movement follow the controller rotation. On release I just show the cursor again

Youll need to setup a rotation input “controller” for the camera.

So you might want something like RMB → Branch True → bMouseBook = true, false bMouseLook = false

Then MouseX and MouseY each would go → Branch(bMouseLook) and addLocalRotation or setRotation or some similar node.

This should allow you to do what you need. Its used to do the inverse, clamp rotation to the sides of the screen a lot.

You can get more complicated and use the GetViewportSize node and maybe do some math to make full right 180 degrees and full left -180 degrees.

Hope this helps
Don’t forget to accept an answer that best clears your question up or answers it so when the community finds your question in the future via search/google they know exactly what you did to fix it/get it going.