Please note that this project was developed for Unity version 4. It currently works, and has been checked, with Unity version 5.1. Please turn annotations on while watching the video, as we can add annotations to the videos when there are discrepancies between the recorded content and the current version of Unity.

import UnityEngine
import System.Collections
[System.Serializable]
public class Boundary:
public xMin as single
public xMax as single
public zMin as single
public zMax as single
public class PlayerController(MonoBehaviour):
public speed as single
public tilt as single
public boundary as Boundary
private def FixedUpdate():
moveHorizontal as single = Input.GetAxis('Horizontal')
moveVertical as single = Input.GetAxis('Vertical')
movement = Vector3(moveHorizontal, 0.0F, moveVertical)
rigidbody.velocity = (movement * speed)
rigidbody.position = Vector3(Mathf.Clamp(rigidbody.position.x, boundary.xMin, boundary.xMax), 0.0F, Mathf.Clamp(rigidbody.position.z, boundary.zMin, boundary.zMax))
rigidbody.rotation = Quaternion.Euler(0.0F, 0.0F, (rigidbody.velocity.x * (-tilt)))