How can I move character Up-down by mouse

Hello I start my school project and watching a tutorial in this video
https://youtu.be/4HpC–2iowE
it works so well I can look left-right by mouse, character follow the camera

but I want it to look up-down too because my character is a fish it swims in the ocean

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour
{
    public CharacterController controller;
    public Transform cam;

    public float speed = 6f;

    public float turnSmoothTime = 0.1f;
    float turnSmoothVelocity;

    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        float horizontal = Input.GetAxisRaw("Horizontal");
        float vertical = Input.GetAxisRaw("Vertical");
        Vector3 direction = new Vector3(horizontal, 0f, vertical).normalized;

        if (direction.magnitude >= 0.1f)
        {
            float targetAngle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg + cam.eulerAngles.y;
            float angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref turnSmoothVelocity, turnSmoothTime);
            transform.rotation = Quaternion.Euler(0f, angle, 0f);

            Vector3 moveDir = Quaternion.Euler(0f, targetAngle, 0f) * Vector3.forward;
            controller.Move(moveDir.normalized * speed * Time.deltaTime);
        }
    }
}

English is not my main language and I’m new to Unity so if my question is dumb or it already teaches in the video I’m sorry bc I didn’t understand English well, Thanks :smiley:

Try using Cinemachine. Cinemachine is a free package for unity that already has a perfect camera script for almost any 3d game. Also it has a collider function that makes the camera not go into any other objects like walls, trees, or maybe other fishes for your game. All you have to do is to go into package manager, download Cinemahine then Cinemachine > Create FreeLook Camera. You can delete your script from the main camera. after that you just have to tweak the FreeLook Camera a little. And you are good to go!

Here is a tutorial about Cinemachine: Intro to Cinemachine - YouTube