Search Unity

Camera zoom for Free Look Camera Rig

Discussion in 'Scripting' started by scarpelius, May 4, 2015.

  1. scarpelius

    scarpelius

    Joined:
    Aug 19, 2007
    Posts:
    966
    I would like to add mouse zoom capability to Free Look Camera Rig and Third Person Controller from Standard Asset, but I am unable to understand how they set up the camera distance from character. The best I can do is to move the Pivot but with erratic results.
     
  2. scarpelius

    scarpelius

    Joined:
    Aug 19, 2007
    Posts:
    966
    Anyone?
     
  3. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    969
    If I remember correctly, you move the camera itself and not the pivot to adjust the distance.

    You can also adjust the field of view on the camera to create a zoom effect.
     
  4. scarpelius

    scarpelius

    Joined:
    Aug 19, 2007
    Posts:
    966
    Thanks, but in the camera script there is no clue about how is the distance from character set. A script added to camera trying to reposition does not work, because something else is making it come back to the old value.
    As for modifying the field of view, is not an option in a 3D game. Maybe in 2D with an isometric camera.
     
  5. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    969
    It's the ProtectCameraFromWallClip script that does this. It looks like you can adjust the distance by changing the m_OriginalDist variable.

    It's commonly used in 3D games for things like sniper scopes or aim down sights, so it does have its uses. Might not be what you're looking for here though.
     
    edwiz7 likes this.
  6. scarpelius

    scarpelius

    Joined:
    Aug 19, 2007
    Posts:
    966
    Thanks @steego for m_OriginalDist, I found that too.
    In my case modifying field of view is not an option as the game is medieval fantasy rpg.