简体   繁体   English

新的 UI 构建器/工具包和 VR 世界空间

[英]New UI Builder/Toolkit & VR World Space

Is it possible to use the new UI builder and Toolkit for World Space UI in Virtual Reality use?是否可以在虚拟现实中使用新的 UI 构建器和 Toolkit for World Space UI?

I have seen ways of doing it with Render Textures but not only does It not seem to be the same as a World Space Canvas (Which I did expect but it´s not even close) but I also don´t find a way of interacting using the VR Raycast method?我已经看到了使用渲染纹理的方法,但它不仅似乎与世界空间 Canvas 不同(我确实预料到了,但它甚至没有接近),而且我也没有找到一种交互方式使用 VR Raycast 方法?

This isn't officially supported yet but is certainly possible for those willing to implement it themselves.这还没有得到官方的支持,但对于那些愿意自己实现它的人来说肯定是可能的。

As the OP mentioned it is straightforward enough to render the UI, the main idea is to set panelSettings.targetTexture to some RenderTexture , which you can apply to a quad like any other texture.正如 OP 提到的那样,渲染 UI 很简单,主要思想是将panelSettings.targetTexture设置为一些RenderTexture ,您可以像任何其他纹理一样将其应用于四边形。 Note that if you have multiple UIs you will need multiple instances of PanelSettings .请注意,如果您有多个 UI,您将需要多个PanelSettings实例。

For raycasting there is a method panelSettings.SetScreenToPanelSpaceFunction which can be used for translating 2d coordinates to panel coordinates, here is an Official Unity Sample demonstrating how it can be implemented in camera space.对于光线投射,有一个方法panelSettings.SetScreenToPanelSpaceFunction可用于将 2d 坐标转换为面板坐标,这是一个Unity 官方示例,演示了如何在相机空间中实现它。 The method is called every update so it can be hijacked to use a raycast from a controller instead of screen coordinates, although I've had mixed results with this approach.每次更新都会调用该方法,因此可以劫持它以使用来自 controller 的光线投射而不是屏幕坐标,尽管我对这种方法的结果有好有坏。

Check out this repo for an example implementation in XR, it is a more sophisticated solution which makes extended use of the input system.查看这个 repo以获取 XR 中的示例实现,它是一个更复杂的解决方案,可以扩展使用输入系统。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM