I have a raycast like so:
if Physics.Raycast(transform.parent.position,direction):
I would like to get the tag of the first object the raycast touches. How do I do that?
I have a raycast like so:
if Physics.Raycast(transform.parent.position,direction):
I would like to get the tag of the first object the raycast touches. How do I do that?
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;
if (Physics.Raycast (ray, hit, 100)) {
print(hit.transform.tag);
}
the ray is going from the camera to where u touch the object