Hello,
I am aware that this question has been asked many times before, however I have spent a whole day trying to get the touch input to work.
In the end, I came up with this script with the help of the match game demo. It is working fine, except for the piece of the script that is to figure out what object was touched and what to do. In my script below, I compare the touched object to an object in the scene, but it does not work. Can anybody provide some help?
var select : GameObject;
var hit : RaycastHit;
while (true)
{
// Use Raycast to check for selection. (Mesh collider attached.)
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if (Input.GetMouseButtonDown (0))
{
if (Physics.Raycast (ray, hit, 100))
{
hit();
}
}
yield;
}
function hit()
{
if(select == gameObject.Find("monkeybody"))
{
//Action goes here
}
}
Thanks in Advance,
Rockdude