Search Unity

RaycastHit Question

Discussion in 'Scripting' started by marty, Jan 16, 2006.

  1. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    When I cast a ray and it hits an object, how can I determine the specific face of the object that was hit?
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
  3. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    Thanks, Joe.

    Yeah, I've been playing with RaycastHit and find the feedback that it provides to be almost complete, minus this one aspect.

    It would be great if I could cast a ray and get not only the name of the mesh with which the ray collided, but a references to the specfic face as well. Is there any chance that this will be supported in a future release of Unity?
     
  4. tsphillips

    tsphillips

    Joined:
    Jan 9, 2006
    Posts:
    359
    Would it be possible to place invisible colliders on the faces? These colliders would function as sensors, much like the sensors in the laser tag game.

    Tom
     
  5. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    That'd still be too much work. I need every face on the mesh, which could be several thousand faces, to be able to return this information.

    It sounds like the upcoming mesh-level access features might allow this.