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?