can someone explain how does this happen…
i tried to use raycast that will detect the object…
the script is attached to the camera childed into the character…
void Update () {
Ray ray = camera.ScreenPointToRay(Input.mousePosition);
ray.direction = camera.transform.forward;
RaycastHit hit;
if(Physics.Raycast(ray,out hit,100)){
if(hit.collider.name == "Cylinder.13"){
Destroy(hit.collider.gameObject);
showCursor = true;
}
Debug.DrawLine(ray.origin,hit.point,Color.yellow);
}
}
the codes are working… but when i’d noticed it in the scene view… the origin of DrawLine goes down…
what is wrong with it?