Issues with my camera

In my game I have a camera following the character. Here is the code:

using UnityEngine;
using System.Collections;

public class CameraNavigation : MonoBehaviour {

    /// <summary>
    /// The targeted game object the camera will follow
    /// </summary>
    public Transform Target;
    /// <summary>
    /// The speed of the camera
    /// </summary>
    private const float pSmoothFollow = 3f;
    /// <summary>
    /// How far the camera will be from the player
    /// </summary>
    private Vector3 pOffset;
    /// <summary>
    /// The Traget Camera position.
    /// </summary>
    private Vector3 pSetTargetCameraPosition;


    /// <summary>
    /// Initialize components
    /// </summary>
    void Start()
    {
        //Initializing the offset
        pOffset = transform.position - Target.position;
    }
    /// <summary>
    /// Update Components
    /// </summary>
    void FixedUpdate()
    {
        // Create a postion the camera is aiming for based on the offset from the target.
        pSetTargetCameraPosition = Target.position + pOffset;
        
        // Smoothly interpolate between the camera's current position and it's target position.
        transform.position = Vector3.Lerp(transform.position, pSetTargetCameraPosition, pSmoothFollow * Time.deltaTime);

        transform.RotateAround(Vector3.zero, Vector3.up, 20 * Time.deltaTime);
    }
}

The problem is that I want the camera to change its view based on where the character is facing and currently its not doing that. Here is a diagram on what I want it to do:

35203-cameradirectionissue.png

Can someone help me figure out what I need to change in my script in order to get it working? Many thanks in advance!

It sounds like you simply need to parent the camera to the root of your character. Why make a complex follow script, if you want the camera to always be behind the player in 3rd person?

How about use the LooAt function. Make the camera look at the player, but only on the axes you want.

Or you could make the the camera’s rotation equal to the rotation of the player.

Or you could use the 3rd person controller asset, it’s one of the standard/sample assets.