RaycastHit

hi again …

i have a game object which contain 10 Planes putting on the scene …
i make this script on the camera "

function Update () {
    var hit : RaycastHit;
    var fwd = transform.TransformDirection (Vector3.forward);
    if (Physics.Raycast (transform.position, fwd, 20)) {
    // 1
    }
}

i would like to return the name of the plane the raycast collide with … on number 1 …
how could i program that ???

RaycastHit has a collider, which has a tag. It may not be the best solution but it’s typically what I do when there is a small number of objects.

you didn’t ask for what it hit.

    if (Physics.Raycast (transform.position, fwd, hit, 20))

then you should be able to do hit.gameObject.name etc…