How to use Graphic Raycaster with WorldSpace UI?

后端 未结 2 1078
温柔的废话
温柔的废话 2020-12-11 18:00

I\'m trying to figure out how Graphic.Raycaster works, but documentation doesn\'t help. I want to use it to cast raycast from some position at a certain angle and hit the U

2条回答
  •  温柔的废话
    2020-12-11 18:49

    Umair M's current suggestion doesn't handle the fact that the ray is originating in world space and traveling at an angle.

    It doesn't look to me like you can do a GUI raycast in world space at an angle even if your canvas is in world space. This page suggests a technique of creating a non-rendering camera, moving it around in 3D space with the ray you want to cast, and then doing the GUI raycast relative to that camera. I haven't tried it yet, but it sounds promising.

提交回复
热议问题