I have been trying to use raycasting to select the game tiles/buttons I have created so far. Every thread and tutorial I have seen either deals with 2D PC ray casting or 3d android raycasting. I would appreciate if anyone could help me out either with pointing me in a different correct direction or helping me out with the code.
I would like to create something along the lines of:
//If there’s at least one finger on your phone and the touch just began
if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
//Creates a ray at the point you are touching
ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);
//If the raycast hit something
if(Physics.Raycast(ray, Mathf.Infinity)){
Debug.Log(“We Hit something”); //If we collided with something say we did
}
}