Multitouch problem in Unity iPhone

I am having some issues with the multitouch in Unity iPhone. I want to apply the following script onto two objects such that I can move my both object at the same time with two different fingers. But whenever I touch one object, other object wont work.

Attached is a screen shot to give a clear understanding of what I am trying to do. I want to rotate the two circles at the same time using two different fingers. I tried having both access from the same script and having two separate scripts, both doesnt solve my problem alt text

var Palette : GameObject;

var prevVecX : float;

var diff: float;

var spinSpeed : int = 360;

function Update () 

{

    var hit : RaycastHit;
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);

    for (var i = 0; i < iPhoneInput.touchCount; ++i) 
    {
        if (Physics.Raycast (ray, hit, 1000))
        {   
            if ( hit.collider == Palette.collider )
            {
                if (iPhoneInput.GetTouch(i).phase == iPhoneTouchPhase.Began) 
                {           
                    Debug.Log("U touched right");
                }

                if (iPhoneInput.GetTouch(i).phase == iPhoneTouchPhase.Stationary)
                {
                    prevVecX = iPhoneInput.GetTouch(i).position.x;
                }

                if (iPhoneInput.GetTouch(i).phase == iPhoneTouchPhase.Moved)
                {

                    diff = iPhoneInput.GetTouch(i).position.x - prevVecX;

                    if(diff >= 0)
                    {
                        Palette.transform.Rotate(Vector3.up * Time.deltaTime * spinSpeed);
                    }

                    else
                    {
                        Palette.transform.Rotate(Vector3.up * Time.deltaTime * -spinSpeed);
                    }
                }

                if (iPhoneInput.GetTouch(i).phase == iPhoneTouchPhase.Ended)
                {
                    Debug.Log("Released");
                }
            }
        }
    }
}

This is because at any given time you only have one raycast when you should have multiple, one for each touch.

The result you're seeing is because of the single raycast, and that you're using an incorrect parameter in Input.mousePosition. It'll work for your first index in the stack (where you touch first) but the condition will never be true for the second.

Here's the part that matters:

 for (var i = 0; i < iPhoneInput.touchCount; ++i) 
 {
     var hit : RaycastHit;
     //I currently don't have my iPhone docs handy so that might not be the way to access the position of your touch
     var ray = Camera.main.ScreenPointToRay (iPhoneInput.GetTouch(i).position);        

     //...

Hope that helps.

==

I m also try to move two cube simultaneously with two finger . I m getting the same problem.
I m not expert in unity. can u share me sample code which is working for multiple touch???

Thanks In advance

Achin