Hello,
I've recently started following the character controller tutorial but a few things are going wrong.
The first thing is that the targetToLookAt game object isn't automatically parenting to the player. Also, the player doesn't rotate as you move him. Does anyone know what is wrong? Here is my TP_Camera script;
Code:
using UnityEngine;
using System.Collections;

public class TP_Camera : MonoBehaviour
{

    public static TP_Camera Instance;
    public Transform TargetLookAt;
    public float Distance = 5f;
    public float DistanceMin = 3f;
    public float DistanceMax = 10f;
    public float DistanceSmooth = 0.05f;
    public float DistanceResumeSmooth = 1f;
    public float X_MouseSensitivity = 5f;
    public float Y_MouseSensitivity = 5f;
    public float MouseWheelSensitivity = 15f;
    public float Y_MinLimit = -20f;
    public float Y_MaxLimit = 40f;
    public float X_Smooth = 0.05f;
    public float Y_Smooth = 0.1f;
    public float OcclusionDistanceStep = 0.5f;
    public int MaxOcclusionChecks = 10;



    private float mouseX = 0f;
    private float mouseY = 0f;
    private float velX = 0f;
    private float velY = 0f;
    private float velZ = 0f;
    private float velDistance = 0f;
    private float startDistance = 0f;
    private float desiredDistance = 0f;
    private Vector3 desiredPosition = Vector3.zero;
    private Vector3 position = Vector3.zero;
    private float distanceSmooth = 0f;
    private float preOccludedDistance = 0;

    void Awake()
    {
        Instance = this;
    }

    void Start()
    {
        //Set Distance between Min and Max
        Distance = Mathf.Clamp(Distance, DistanceMin, DistanceMax);
        startDistance = Distance;
        Reset();
    }

    void LateUpdate()
    {
        if (TargetLookAt == null)
            return;

        HandlePlayerInput();


        CalculateDesiredPosition();


        UpdatePosition();
    }

    void HandlePlayerInput()
    {
        var deadZone = 0.01f;

        //Check RMB down
        if (Input.GetMouseButton(1))
        {
            //Get Mouse axis input
            mouseX += Input.GetAxis("Mouse X") * X_MouseSensitivity;
            mouseY -= Input.GetAxis("Mouse Y") * Y_MouseSensitivity;
        }

        //Limit Mouse Y rotation
        mouseY = Helper.ClampAngle(mouseY, Y_MinLimit, Y_MaxLimit);

        //Check Scroll Wheel outside deadZone
        if (Input.GetAxis("Mouse ScrollWheel") < -deadZone || Input.GetAxis("Mouse ScrollWheel") > deadZone)
        {
            //Set within Min/Max
            desiredDistance = Mathf.Clamp(Distance - Input.GetAxis("Mouse ScrollWheel") * MouseWheelSensitivity, DistanceMin, DistanceMax);
        }
    }

    void CalculateDesiredPosition()
    {
        //Evaluate distance
        Distance = Mathf.SmoothDamp(Distance, desiredDistance, ref velDistance, distanceSmooth);

        //Calculate desired position
        desiredPosition = CalculatePosition(mouseY, mouseX, Distance);
    }

    Vector3 CalculatePosition(float rotationX, float rotationY, float distance)
    {
        Vector3 direction = new Vector3(0, 0, -distance);
        Quaternion rotation = Quaternion.Euler(rotationX, rotationY, 0);
        return TargetLookAt.position + rotation * direction;
    }


    void UpdatePosition()
    {
        //Smooth X
        var posX = Mathf.SmoothDamp(position.x, desiredPosition.x, ref velX, X_Smooth);

        //Smooth Y
        var posY = Mathf.SmoothDamp(position.y, desiredPosition.y, ref velY, Y_Smooth);

        //Smooth Z
        var posZ = Mathf.SmoothDamp(position.z, desiredPosition.z, ref velZ, X_Smooth);

        //Assemble into a position
        position = new Vector3(posX, posY, posZ);

        //Set camera position
        transform.position = position;

        //Have camera look at TargetLookAt
        transform.LookAt(TargetLookAt);
    }

    public void Reset()
    {
        mouseX = 0;
        mouseY = 10;
        Distance = startDistance;
        desiredDistance = Distance;
    }
    public static void UseExistingOrCreateNewMainCamera()
    {
        GameObject tempCamera;
        GameObject targetLookAt;
        TP_Camera myCamera;
        GameObject Player;

        //Check for Main Camera
        if (Camera.main != null)
        {
            //Assign Main Camera
            tempCamera = Camera.main.gameObject;
        }
        else
        {
            //Create Main Camera
            tempCamera = new GameObject("Main Camera");
            //Add Camera component
            tempCamera.AddComponent<Camera>();
            //Tag as MainCamera
            tempCamera.tag = "MainCamera";
        }

        //Add TP_Camera Script
        tempCamera.AddComponent<TP_Camera>();
        //Reference TP Camera component
        myCamera = tempCamera.GetComponent("TP_Camera") as TP_Camera;

        //Assign return from targetLookAt
        targetLookAt = GameObject.Find("targetLookAt") as GameObject;

        //Check for targetLookAt
        if (targetLookAt == null)
        {
            //Create targetLookAt
            targetLookAt = new GameObject("targetLookAt");
            //Position at World Origin
            targetLookAt.transform.position = Vector3.zero;
        }

        //Assign local targetLookAt transform to public TargetLookAt
        myCamera.TargetLookAt = targetLookAt.transform;
    }
}
Thanks in advance.