网站改版好吗,做试卷挣钱的网站,南通建设公司网站,godaddy主机到网站一、XR Poke Interactor
交互包括发起交互的对象#xff08;Interactor#xff09;和可被交互的对象#xff08;Interactable#xff09;。XR Interaction Toolkit提供了XR Poke Interactor脚本用于实现Poke功能。在LeftHand Controller和RightHand Controller物体下创建名…一、XR Poke Interactor
交互包括发起交互的对象Interactor和可被交互的对象Interactable。XR Interaction Toolkit提供了XR Poke Interactor脚本用于实现Poke功能。在LeftHand Controller和RightHand Controller物体下创建名为Poke Interactor的空物体并添加XR Poke Interactor脚本。设置XR Poke Interactor中的Attach Transform在手部模型下创建代表交互点的子物体如Poke Point并将其拖至XR Poke Interactor脚本中的Attach Transform处。 若手部有其他Interactor可将Poke Interactor添加到LeftHand Controller和RightHand Controller上的XR Interaction Group中确保一个Interactor起作用时其他Interactor暂时失效。 二、与UI进行触控交互 添加Tracked Device Graphic Raycaster和XR UI Input Module让UI可被交互在Canvas上添加Tracked Device Graphic Raycaster脚本; 在EventSystem上添加XR UI Input Module脚本。
三、与物体进行交互 XR Simple Interactable 用红色方块代表可交互物体添加XR Simple Interactable脚本。在XR Simple Interactable的Interactable Events中添加事件如在Select Entered时让方块材质变成黄色在Hover Exited时让方块材质变回红色。这个在前面学过由于XR Simple Interactable默认会被其他Interactor触发为避免手靠近方块时按下手柄Grip键触发Select Entered事件可将XR Poke Interactor的Interaction Layer Mask和方块挂载的XR Simple Interactable的Interaction Layer Mask进行设置。经测试在XRI 2.3.2版本下可将XR Simple Interactable的Interaction Layer Mask单独设置一个层级如“Poke”XR Poke Interactor的Interaction Layer Mask设置为Everything使Poke Interactor单独与方块进行交互。 这个也学过 XR Poke Filter 运行程序时若无法触发Poke是因为XR Poke Interactor默认勾选了Require Poke Filter此时能发生Poke交互的物体必须拥有XR Poke Filter组件。在方块上添加XR Poke Filter组件可调整Poke Configuration参数如将Poke Direction设为Negative Y即手指从上往下触碰方块时可触发Poke。
通过以上步骤我们成功实现了Unity VR中的手指触控交互功能为VR体验增添了更多自然和直观的交互方式。