Creating a simple mini-map?

I’m trying to create a simple mini-map for my latest project, but can’t seem to get it to work entirely.

I’ve already created the camera, and all settings are right (depth, layer etc), so it already looks like a mini-map. The camera will follow the player on the x and z axes (not the y), but I can’t get it to rotate properly… I want the camera to always look at the terrain from above, of course.
Also note that the player controls an airplane that can adjust its pitch, and can also fly upside-down if rotated enough.

I’m currently using this code for the mini-map camera:

#pragma strict

var minimapTarget : Transform;
var smooth : float = 3;

function Start () {

}

function Update () {

    transform.position.x = Mathf.Lerp( transform.position.x, minimapTarget.position.x, Time.deltaTime*smooth );
    transform.position.z = Mathf.Lerp( transform.position.z, minimapTarget.position.z, Time.deltaTime*smooth );
    
}

How can I get this to rotate with the player?

Create new Camera and Set this Script to your new Camera

var target : Transform;
var distance : float;
var height : float;
var damping :float;
var rotDamp : float;
function LateUpdate () {
var wantedPosition = target.TransformPoint(0,height,-distance);
transform.position = Vector3.Lerp(transform.position,wantedPosition,Time.deltaTime*damping);

var wantedRotation = Quaternion.LookRotation(target.position - transform.position,target.up);
transform.rotation = Quaternion.Slerp(transform.rotation,wantedRotation,Time.deltaTime*rotDamp);

}

after that, you can adjust your own setting to this camera…

Why not set the camera’s transform.rotation.z to be equal to the target’s? That could work.