Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

IUsesRaycastResults returns more info of what is hitting

Discussion in 'EditorXR' started by AgOrisTWL, Apr 20, 2018.

  1. AgOrisTWL

    AgOrisTWL

    Joined:
    Jul 10, 2014
    Posts:
    3
    Hello, hope you are having a good day.

    I'm checking out the developer's documents in EditorVR, to add a tool that connects with ProBuilder (still trying jaja). I like the way how it adds services to the tool with interfaces, And I'm right now in IUsesRaycastResults to check the object the ray hits. If I'm not wrong, it only returns the object that has been hit (if it hit something), but it seems that just return the GameObject. There is a way to find where exactly the ray has hit? like a hit-mesh position, a triangle or a vertex of the mesh.

    I'm trying to find the ray's hitting position (better if it's in screen space position) in the object to send it as a parameter in ProBuilder's editor, and start to update the brush.

    Thanks in advance, hoping there is a way to get this position using what IUsesRaycastResults already has :)
     
  2. amirebrahimi

    amirebrahimi

    Joined:
    Jan 27, 2008
    Posts:
    171
    Currently, IUsesRaycastResults only gives you the GameObject. You could then shoot out another ray if you like from the ray origin by also including IUsesRayOrigin to get the actual collision info or opt to do that instead of using IUsesRaycastResults.
     
    Larva_JorgeRam likes this.
  3. Larva_JorgeRam

    Larva_JorgeRam

    Joined:
    Aug 17, 2017
    Posts:
    2
    Oh yeah, true, jaja. Thanks! I'll check it out now