how can a camera zoom into a game object?

Hello.
I am working on making a quiz which asks students to label the bones on face. Well, i want the camera to zoom into the object of interest when the game object in question appears and get back to default position at the end of it. How can i achieve this. I have tried look at, cameraFacing Billboards and all. But nothings working.
all i have got till now is a list of 10 bones, they are separate game objects, which change their colour when a question describes about them. I want the camera to rotate to show the game object of interest.

3 Answers

3

A script with a “target transform” and “transform.lookat(target)” (see scripting ref)

And then you change that target whenever you want to lookat something new.

Or position the camera a some preset positions. Each bone has a child empty gameobject to mark where you want the camera to be. Then you can put these in an array (to easily choose the one you want) and set “transform.position=target.position” and “transform.rotation=target.rotation”.

Thank You So much. This makes sense. I will get back once i check this on my game.

I try this but my camera also rotate with object so any solution of this problem?

Use camera.main.fieldOfView
reduce the field of view to get zoom in effect and increase the field of view to get zoom out effect

may be help you Camera Auto Camera Unity 3D 5 - YouTube