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?
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(hit.transform.name);//Object you touched
}
}
}
Place what you want it to do in place of the: Debug.Log(hit.transform.name);. I Put: gameObject.AddComponent(Rigidbody);. So that when i touch the object it falls