Answers for "panning script c# on phone"

C#
0

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;
}
Posted by: Guest on June-25-2021

C# Answers by Framework

Browse Popular Code Answers by Language