Moving 2 objects with this script... easy, right?

Hi, all,
I’m using the following code to move a 2D object.
It works well, but I would like to modify this script to enable two objects to be dragged independently.

Any ideas?

Thanks,

Greg

var object : GameObject;
var speed = 5.0;
var swipeVector = Vector2.zero;

function Update () {
  if(iPhoneInput.touchCount > 1) {
    var touch = iPhoneInput.GetTouch(1);
    swipeVector = touch.positionDelta * Time.deltaTime * speed;
    object.transform.position += swipeVector;
  }
transform.position.x = Mathf.Clamp(transform.position.x, -5, 5.2);
transform.position.y = Mathf.Clamp(transform.position.y, -1, 4.5);
}

Why are you reposting the exact same question you already have posted before? Also, why aren’t you posting these iPhone specific questions in iPhone Development?

:slight_smile:

http://forum.unity3d.com/viewtopic.php?t=33047

FYI: I’m locking this thread, all replies and follow-up should be done in the above thread (t=33047).