Forum Discussion

Weald_Spatial's avatar
Weald_Spatial
Brass Contributor
Mar 04, 2024

Physics Raycast not exposing the Hit result

In the Unity Visual Scripting graph the Physics Raycast node doesn't expose the Hit result output so I can get the distance from the origin to the collider. Here's a screenshot to show you what I mean.

Any ideas? How do you get the Raycast Hit object?

  • Hey Weald_Spatial! Thanks for bringing this up. This looks like a simple oversight, especially since these overloads are available in non-Mesh Visual Scripting. I'll make a note of it and check if we can expose these overloads in an upcoming release.

  • Weald_Spatial's avatar
    Weald_Spatial
    Brass Contributor
    I have confirmed that some nodes include the `Hit info` as an output and these are missing from the Mesh subset. Could somebody from the dev team explain why we can't use Raycasts and get the hit information?
    • Weald_Spatial's avatar
      Weald_Spatial
      Brass Contributor
      Whilst I kinda understand not exposing this property in the SDK for security reasons, it would be better if they allowed us to access the Raycast Hit and restrict the options available from those nodes instead. So just allow us the Raycast Hit nodes that give us data like distance but not the target collision object as this could open up to accessing GameObjects they don't want you to meddle with.

Resources