I have added a second camera to show a top down map. I parented it to the main camera so it inherits the players movements. I have altered the depth and size of the second camera to show its view in the lower left. How do I disable the mouse look control on the second camera so it remains fixed-looking straight down?
If your “Main Camera” is still called this, then this script should do what you want (it’s in js) :
#pragma strict
//Object/Script access vars.
private var oMainCamera : GameObject;
//Transform vars.
private var tMy_Transform : Transform;
private var tMain_Cam_Transform : Transform;
//Height Adjustment var.
private var fMap_Cam_Height_Adjustment : float;
function Awake () {
//Connect to Objects and Scripts.
oMainCamera = GameObject.Find("Main Camera");
}
function Start() {
//Initialise vars.
tMy_Transform = transform;
tMain_Cam_Transform = oMainCamera.transform;
fMap_Cam_Height_Adjustment = 20f;
}
function LateUpdate() {
if (oMainCamera != null) {
tMy_Transform.position = Vector3(tMain_Cam_Transform.position.x, (tMain_Cam_Transform.position.y + fMap_Cam_Height_Adjustment), tMain_Cam_Transform.position.z);
}
}
Remember to un-parent you map cam from your main cam for this to work, adjust the height offset to whatever you desire.