Move with navMesh - Camera problem

Hello,

I add a navMesh to my sphere in order to move it, without it being able to cross the end of the zone.

I add this script to my sphere :

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

public class ClickAndMove : MonoBehaviour
{

    private NavMeshAgent _agent;

    void Start()
    {
        _agent = GetComponent<NavMeshAgent>();
    }

    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            RaycastHit hitInfo;

            if(Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hitInfo,100))
            {
                _agent.SetDestination(hitInfo.point);
            }
        }
    }


}

Problem:

If I click, the sphere moves towards the clicked place, but the camera is badly positioned. The camera rotates when it should stay behind the sphere. Do you know what this problem is related to?

thanks in advance

this is because the camera is in the wrong rotation and position…I mean that place the camera to the back of player so
that it faces where the player is facing…

Oh yes thank you, the “Field of views” was completely misplaced.

I am in awe of the work of some peoples, it’s so complicated.

Its Ok!!!..I help others while i can’t solve my problems related to unity