Hi,
I want to create a map for my 3D scene. So I have placed a camera in the sky looking down. When M is pressed, I’m switching from the character controller camera to this camera. Now I want to move this camera in up, down, left and right directions with mouse’s movement and change height of camera with scrolling middle mouse button.
I have this script
var camera1 : Camera;
var camera2 : Camera;
function FixedUpdate()
{
if (Input.GetKeyDown (KeyCode.M))
{
GameObject.Find("First Person Controller").GetComponent("SmoothMouseLook").enabled = false;
GameObject.Find("First Person Controller").GetComponent("FPSWalker").enabled = false;
camera1.enabled=true;//2D camera
camera2.enabled = false;//first person camera
moveDirection = new Vector3(Input.GetAxis("Mouse X"), 0, Input.GetAxis("Mouse Y"));
camera1.transform.position += moveDirection;
}
}
But 2d camera (camera1) doesn’t move when I drag the mouse. What’s the problem?