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);
}