Hey everyone, I’m currently working on a little demo scene and now I got stuck with some camera rotation issue.
I actually want to archive something that is really common in modern 3rd person shooter games but I can’t figure out how to solve it.
So here is the idea:
While exploring the world the player should be able to freely rotate (mouse/right stick) the camera in every direction and arround the character, also the character movement should also be totally free. Like in most common 3rd person game, right?
But when aiming down the sights of a gun the camera should zoom in and switch to a shoulder view (already implementet)
But while the player is pressing the aim button I want to controle the direction the player is aiming at and let the camera be fixed in shoulder view.
I figured I can archive both effects while switching of/on “use controller rotation Yaw/Pitch” in the pawn menu of my 3rd person character BP.
How to switch between these two seetings in a Blueprint via bool “isAiming” for example? Is it even possible or do I need some kind of workaround?
Any help on this is highly appriciated!
Note: I’m a 3D-Artist, so please bear with me…
Create a function that sets / unsets the required variables. Now call this function when you press the “Aim Down Sight” button. On button press, set the variables to use the Shoulder Camera settings. On button release, set the variables to use the Third Person settings. Or, if you want to use “toggle style”, use a flip flop node instead of Press and Release.
Thanks for you reply! We’ll that is actually my problem. I haven’t found a way to get access to these settings via Blueprints or is there a particular node I’m not able to find?
Ok, got it working. Still has some room for improvement but this is the recent set up for anyone who is in need for it.
There is a simpler way. Assuming that you are using Third Person Template, use the variable as follows
- “Use Pawn Control Rotation” from “Follow Camera” component
- “Use Controller Rotation Yaw” from the “Character” class itself
- “Orient Rotation to Movement” from “Character Movement” component
Setup as shown in the image. Basically what it does is set the camera to be fixed to the Pawn movement (specifically the “Capsule Component”) and forces the Pawn to lock to mouse input.
The above image shows implementation as a function, to lock the Camera you will set the function’s Enable input to True
Yes, I’m using the template. Thanks a bunch for sharing, thats way better then what I had!
I came up with this yesterday, wich seams to also work very well but will def try your solution:
this was the answer to hours of tutorials that just quite didn’t do what i needed. Thanks for posting