Suppose that I have the three game(cube,Quard,sphere) object. When I click on a particular game object suppose think I have clicked on the cube,the cube object should get zoomed in on the screen.
how can I do that?
How do I center and zoom into my cube game object after selecting the cube? I think it has something to do with the camera but how do I center the view with the camera?
I have used the below code for zooming the object.For one object its working.But when I place different object and apply this code then when i click on one object all the three object is getting zoomed.
Can anyone help me out in solving this issue
Here is the code
function OnMouseDown()
{
OrthoZoom(1.5);
}
function OrthoZoom(size : float) {
var cam = Camera.main;
while (cam.orthographicSize != size) {
cam.orthographicSize = Mathf.MoveTowards(cam.orthographicSize, size, speed * Time.deltaTime);
yield;
}
}