Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

IUsesRaycastResults returns more info of what is hitting

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

  1. AgOrisTWL


    Jul 10, 2014
    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


    Jan 27, 2008
    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


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