Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

panning script c# on phone

#pragma strict

// The target gameObject.
var target: Transform;

// Speed in units per sec.
var speedLeft: float = -10;

private static var isPanLeft = false;


function FixedUpdate()
{
if(isPanLeft == true)
{
    // The step size is equal to speed times frame time.
    var step = speedLeft * Time.deltaTime;

    // Move model position a step closer to the target.
    transform.position = Vector3.MoveTowards(transform.position, target.position, step);
}
}

static function doPanLeft()
{
    isPanLeft = !isPanLeft;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #panning #script #phone
ADD COMMENT
Topic
Name
9+8 =