Search Unity

Click and drag mouse for panning

Discussion in 'Scripting' started by aswinindra, Apr 24, 2008.

  1. aswinindra

    aswinindra

    Joined:
    Oct 24, 2007
    Posts:
    38
    Hello All,

    I could not find any script tutorial how to do click_drag for panning the fixed view. I know, its somehow might be easy through input manager..(I still don't know how to use it, or pairing it through script or game object).

    I am kind of asking a lot, I need more to learn script.

    Thank for all the kindness.
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    Try this for starters.
    Code (csharp):
    1.  
    2. var panSpeed : float = 1.0; //multiplier
    3. function LateUpdate() {
    4. transform.Translate(Input.GetAxis("Horizontal")*panSpeed, Input.GetAxis("Vertical")*panSpeed, 0);
    5. }
    6.