Hii, everybody...
I am trying to solve one problem from last few days, but didnt get successful to solve it completly.
i want to check that user has clicked on all cubes or not. if he clicked on all prefabs( cubes)in the scene then only nxt scene will apperared.
Now for this things i am using raycast concept to check our cube is hitted or not.
Just look at my following code.
function Update ()
{
if(Input.GetMouseButtonDown(0))
{
var hit:RaycastHit;
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if (Physics.Raycast (ray,hit,100.0)) {
Debug.Log("clicked");
if(hit.transform.name=="box1") //here box1 is my prefab(cube) name
{
isTouchCube1=true;
}
if(hit.transform.name=="box2") //here box2 is my prefab(cube) name
{
isTouchCube2=true;
}
if(isTouchCube1 &&isTouchCube2)
{
Application.LoadLevel ("oops_01");
}
}
}
}
my code simply gives the idea what i'm trying to do ,
So anybody is there to solve this issue ?
Or if u r having any other method code to solve this issue the also helpful for me.
Also one imp question where should i need to attach this script? currently i'm attaching to all cubes for
whom i'm checking they r hitted or not.
If there is problem with understanding of my question then also plz tel me.
– anon62947158