Unity Community


Results 1 to 6 of 6

Thread: camera zoom....


  1. Posts
    513

    camera zoom....

    Hello Unityrs,

    I need to implement the Zoom In/Out for the camera. now, it might be just a matter of changing the FOV, but it's not a real Zoom, or moving the camera along the line towards the target. So I wonder, if there is anything already implemented in Unity camera Class or in Transform which might be helpful.

    Regards,
    Giancarlo


  2. Location
    New Jersey
    Posts
    791
    What context do you mean "zoom in and out." In some situations moving the camera itself is most appropriate, in other situations changing the FOV is the best solution.

    If you mean the kind of zoom you'd see in say, gears of war when you enter iron-sights mode that is accomplished mostly by changing the FOV of the camera, with a slight reposition to taste.

    If you mean the kind of zoom you'd see in a strategy game, that can be accomplished by simply moving the camera around a bit.

    What kind of script are you using to handle the camera right now? As actually accomplishing either method is going to depend quite a bit on your current implementation.


  3. Location
    Bloomington, IN, USA
    Posts
    367
    I'm likewise unclear on how changing the field of view isn't "real zoom" since it most closely mimics how an actual camera lens works. As for what's in the API to accomplish this task, I'd suggest you get familiar with the documentation, in this case for Camera and Transform, where you'll find Camera.fieldOfView and Transform.Translate().

    Additionally, you might have better luck getting an answer to this question in Support or Scripting, as this isn't really a GUI related question.
    ~Francis
    Software Developer, WisdomTools, Inc.


  4. Location
    Brisbane, Australia
    Posts
    446
    giancamati - changing the FOV is what 'real zoom' is. If you want the camera to approach and retreat from the subject, it's a 'dolly' and is accomplished by moving the camera.

    The best way to do this is going to depend on how your camera is set up, but if you parent it to an empty game object you can adjust the camera's transform.localPosition.z in script and be able to set it to 0 whenever you want to put things back to normal.


  5. Posts
    1,887
    Ye I confirm that the "ZOOM" function is just and only a FOV change.


  6. Posts
    513
    Guys really thank you so much!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •