Guys, I attached the third-person camera to the character’s head for realism (to show the body, etc.). I limited the camera rotation using Clamp and Normalize Axis, but now while the character moves freely, the camera stays fixed and only moves within certain angles. I want to make this camera constraint dynamic - it should limit rotation relative to where the character is looking. I’d appreciate any help with this.
Hey @EmirGuney how are you?
I’ve been trying to do this on my project and this is the way I did:
-
First, this is my character config
-
This is my CameraBoom (Spring Arm) config:
-
You will need a variable to set the Max Yaw, I set it to 45 degrees
-
Then, you need to implement this code:
What we are doing here is to check if the angle between the camera rotation and the character forward vector is going to be more than our Max Yaw variable after we apply the “Action Value X” of our mouse input. -
The last thing to do is to update in every tick the “center” of our camera in relation with our character’s forward vector:
And with that you should be fine!
There are some polish to do, but that is the base logic behind what I understand you want to do!
Let me know if this helps you!