Search Unity

Camera orbit request

Discussion in 'Editor & General Support' started by superlol, Mar 21, 2011.

  1. superlol

    superlol

    Joined:
    Dec 6, 2010
    Posts:
    10
    Hi all!

    I'm looking for a mouse orbit script that satisfy this request:

    Playing with the standard mouse orbit I met the limit of the Y axis, when I'm on the top of the target the camera spin around



    What I want is a different behavior, as show in the next screenshots




    How can I modify the mouse orbit script to achieve that?

    Tnx a lot :)
     
  2. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    Hi, welcome to the forum!

    You can do this by using the transform.RotateAround function. The point is the centre of the sphere, the axis is the camera's local X or Y axis (X for upwards movement, Y for sideways) and the angle is determined by the movement delta. However, under these circumstances, the camera is not "locked" upright with respect to the sphere, so its angle can wander and it may be difficult to control with the mouse. Is this the behaviour you need or is there something particular about the poles that lets you change direction?
     
  3. Cawas

    Cawas

    Joined:
    Jan 14, 2010
    Posts:
    121