is it possible to touch 3d-Object for using Unity in iPhone ?

is it possible to touch 3d-Object for using Unity in iPhone? how about HitTest? i used to this. but i failed. HitTest support only two things.( GUILayer.HitTest , GUIElement.HitTest )

also i tryed to get an Application dataPath in iPhone. i could get datapath in Unity3d. but i faild in iPhone. is it possible ? any idea?

hello, yes, is possible.

Use a raycast and make sure your 3D Object has a collider :)

Checkout this:

private var hit : RaycastHit;
private var ray : Ray;//ray we create when we touch the screen

function FixedUpdate () {

    if(iPhoneInput.touchCount == 1) {
        ray = Camera.main.ScreenPointToRay(iPhoneInput.touches[0].position);
        Debug.DrawLine(ray.origin,ray.direction * 10);
        if(Physics.Raycast(ray.origin, ray.direction * 10,hit)){
            Debug.Log(;//Object you touched

hope it helps.

Great Please elaborate - the item is touched and now I want another item to do something not the object that was touched.


Place what you want it to do in place of the: Debug.Log(;. I Put: gameObject.AddComponent(Rigidbody);. So that when i touch the object it falls

Found this video quite useful:

using layers and raycast to touch and move a 3d Object.

source code is here:

Hi thank you the beautiful script!
How can I open a GUI window with some text into, when I touch one or more object?!