2 Replies Latest reply on Feb 6, 2007 1:13 AM by Nickname_is_none

    Zoom In/Out

    Nickname_is_none
      I'm trying to zoom in/out of a 3D room. At the moment, I've replicated this using a translate function:

      if gZoomIn then pCamera.translate(0,0,-1) --gZoomIn refers to the mousedown of a different sprite

      But I don't want to move the whole camera. Is the 'FieldOfView' the best function to use? I can set this to a specific angle (like 90 below) but I can't seem to increment this by +/-1 on a mousedown

      if gZoomIn then pCamera.fieldofview =90

      Any ideas on how to script this?
        • 1. Re: Zoom In/Out
          duckets Level 1
          Yes, the 'zoom' feature of real-life cameras is the equivalent of the field of view of director 3d camera objects. Physically moving the camera forwards and backwards towards the target is actually called 'dollying' in real life.

          To narrow the field of view by one degree per frame, you could use something like this:

          if gZoomIn then pCamera.fieldofview =pCamera.fieldofview - 1

          You'll want to limit it to a minimum though, which can easily be achieved by using the 'max' command:

          if gZoomIn then pCamera.fieldofview =max(30,pCamera.fieldofview - 1)

          The above line will zoom in, but keep the field of view from going lower than 30 degrees. The matching 'zoom out' would look like this:

          if gZoomOut then pCamera.fieldofview =min(120,pCamera.fieldofview + 1)


          hope this helps!

          - Ben




          • 2. Re: Zoom In/Out
            Nickname_is_none Level 1
            Ahhhh, great thanks, that's working now. I was halfway there!!