hello can you help me, i dont know how to use the raycast!, i have this code but when i click an object , it dont do nothing…
function Raycast (ray : Ray, out hitInfo : RaycastHit, distance : float) : bool
{
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;
if (collider.Raycast (ray, hit, 100)) {
Debug.DrawLine (ray.origin, hit.point);
print("it works");
}
}
Moderator Edit by HiggyB: I updated your title, all caps is shouting and it’s best to use something a bit more descriptive than just “Raycast”. Also, wrap any code bits in a [ code ]…[/ code ] block (remove the spaces) for nicer formatting.