Search Unity

Problem with Camera-Movement/Rotation/Angle...

Discussion in 'Scripting' started by Elharter, Jan 11, 2018.

  1. Elharter

    Elharter

    Joined:
    Sep 20, 2015
    Posts:
    58
    Hi Guys,

    i try to realize a camera movement like this one:


    The rotation thing is done and fully working. Ive created a viewport placed in the center of the map and attached the camera in it.

    The main problem is the angle.....if i changed the angle the camera position is moving and all other settings like position.x, position.y, position.z are changing.

    Anyone an idea how can realize the same camera movement like the youtube example?

    thanks
     
  2. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    I really should make some kinda of copy paste for this answer :)

    I would suggest that you use a 3-part camera
    Rig (empty game object)
    - child Pivot (empty game object)
    - - child Camera (actual camera)

    Now, the Rig only rotates on the y-axis.
    The Pivot only rotates on the local x-axis. (must clamp this value, usually, too)
    and the camera can zoom. (can clamp this value, also)
     
  3. Elharter

    Elharter

    Joined:
    Sep 20, 2015
    Posts:
    58
    Yes this works!!!
    Thanks a lot :)

    Great!
     
  4. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Cool. Glad I could help. :)

    Enjoy your game.