How to add a rotation to this?

I have this 3rd person camera which I need to rotate along with the player objects rotation but added into this input you see in the code.

How do I add(or subtract)the player.rotation into the horizontal axis in this code:

angleH += Mathf.Clamp(Input.GetAxis("Mouse X") + Input.GetAxis(Input.GetAxis("Horizontal"), -1, 1) * hAimingSpeed * Time.deltaTime;


    
    angleH += Mathf.Clamp(Input.GetAxis("Mouse X") + Input.GetAxis(Input.GetAxis("Horizontal"), -1, 1) * hAimingSpeed * Time.deltaTime;
    


Quaternion aimRot = Quaternion.Euler(-angleV, angleH, angleF);

It because the player starts turning towards the mouse whilst running but the camera does not stay with it. I need it rotate add the players rotation too. Even cancel mouse rotation on the horizontal axis.

If its confusing to you please let me know I will try my best to explain. I really need this fix. I’m so close to getting what I want. Please help.

1 Answer

1

Never mind figured it out.

    angleH += Mathf.Clamp(player.rotation.y, -1, 1) * hAimingSpeed * Time.deltaTime;

… but now its rotating to the opposite direction… lol.