switching cam by clicking on an object

hi folks,
i am trying to create a virtual tour of a housing project. i have one orbit cam, that orbits around the whole layout in an aerial view. what i want is to have multiple first person cams all over the site, and some sort of objects like a ball or a cylinder which you can click and the cam next to it will get activated. i tried something like

function OnMouseDown() {
CamOrbit.camera.enabled = false;
Cam1.camera.enabled = true;
}

but i can not figure out how to make it work.

I think to be able to find the cams, you would have to give them each a tag name and then use
var go = GameObject.FindWithTag(“cam1”);
go.enabled = true;
go = GameObject.FindWithTag(“CamOrbit”);
go.enabled = false;

i dont yet understand how, but ill try to. thanks for the answer fireside.

That probably wasn’t the simples way. A simpler way would be
var cam1:Camera
var camOrbit:Camera

function OnMouseDown() {
camOrbit.enabled = false;
cam1.enabled = true;
}

Attach the script to the cube, then drag the camera’s onto the varibles when the cube is highlighted and it shows the script

If you want it to happen when you click an object in the scene you will need to raycast to find the object

thanks fireside, it worked like a charm :slight_smile:
p.s. is there any way to change the mouse pointer to hand when it is over the clickable object?