I have this set up so using the left mouse button fires a raycast from the camera. I have no idea how to check for collision with the raycast and a gameobject. I've looked everywhere, And I'm completely lost.
function Update () {
if (Input.GetButtonDown("Fire1")) {
var tbbeam : Ray = Camera.main.ViewportPointToRay (Vector3(0.5,0.5,0));
var hit : RaycastHit;
Physics.Raycast (tbbeam, hit);
if(RaycastHit.point(Vector3(0,0,0))){
Debug.Log("Hit.");
}
Debug.DrawRay (tbbeam.origin, tbbeam.direction * 10, Color.white);
}
}
P.S., I am a beginner. PLEASE HELP ME. I'VE BEEN GRUELING OVER THIS FOR HOURS.