I know it should be done with raycasting method but I don't get the point on making it works... Any idea?
Thanks
I know it should be done with raycasting method but I don't get the point on making it works... Any idea?
Thanks
You need to do something like this:
EDIT: okay, some code to help you:
function Update () {
if (Input.GetButtonDown("Fire1")) {
var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
var hit : RaycastHit;
if (Physics.Raycast(ray, hit)) {
// hit will now contain info about the object clicked upon
hit.transform.gameObject.SetActiveRecursively(false);
}
}
}