Moving An Object With Touch

Posted by Arman on Stack Overflow See other posts from Stack Overflow or by Arman
Published on 2010-12-29T09:50:06Z Indexed on 2010/12/29 9:54 UTC
Read the original article Hit count: 249

Filed under:
|
|
|
|
for(touch in iPhoneInput.touches) {
     if(touch.phase == iPhoneTouchPhase.Moved || touch.phase == iPhoneTouchPhase.Began) {
          transform.position = Camera.main.ScreenToWorldPoint(new Vector3 (touch.position.x, touch.position.y, 10));
     }
}

I have found the above code from tutorial Moving An Object With Touch but its not working when I play game in Unity3D. Can some one please help me.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk-4.0