Unity 3D – Camera – Third Person Control

1. Create a ball that rolls over a plane

2. Creare a Camera with:
– CameraController.js

#pragma strict

public var player : GameObject;
private var offset :  Vector3;

function Start () {
offset = transform.position;
}

function LateUpdate () {
//LateUpdate is called after all Update functions have been called. 
// This is useful to order script execution. For example a follow camera should always be implemented in LateUpdate because it tracks objects that might have moved inside Update.
transform.position = player.transform.position + offset;
}

2. Hierarchy DRAG AND DROP ‘ball’ GameObject over Inspector> CameraController.js ‘player’ variable slot.