im using this kind of code…
public var myCamera : Camera;
var hit : RaycastHit;
var rayDistance : float = 100;
function Update () {
var ray = myCamera.ScreenPointToRay (Input.mousePosition);
if (Input.GetMouseButtonDown (0)){
if (Physics.Raycast (ray, hit, rayDistance)) {
INSERT DESTROY OBJECT THAT THE MOUSE HAS CLICKED HERE!
}
}
}
can somebody please point me in the right direction? i need to destroy the object the mouse has clicked…
thanks in advance!