Im new to java programming coming from a decent background in c. Im currently working on a android game where a player walks around in 3d searching for items. I have this script on my test objects to register touches
var particle : GameObject;
function Update () {
for (var touch : Touch in Input.touches) {
if (touch.phase == TouchPhase.Began) {
// Construct a ray from the current touch coordinates
var ray = Camera.main.ScreenPointToRay (touch.position);
if (Physics.Raycast (ray)) {
// Create a particle if hit
Instantiate (particle, transform.position, transform.rotation);
}
}
}
}
However while using the 3d controller prefab, when ever I touch a joystick it also registers my test objects as being touched and thus would pick up every item in my scene. I would greatly appreciate the help in how to resolve this issue.