unity3d - 如何使用 Oculus Touch GazeRing 销毁 GameObject?
问题描述
我将 Oculus VR 集成到一个简单的场景中,该场景基本上只包含一个球体:
现在我想在使用右手 Oculus Touch 设备点选球体时“摧毁”球体。Blue GazeRing 挂在 RightHandAnchor 下方。
Sphere,名为 Ball,配置如下: sphere 游戏对象的配置
InputManager GameObject 有一个组件“控制器输入(脚本)”:
public class ControllerInput : MonoBehaviour {
public Transform pointerTransform;
void Update () {
if (OVRInput.Get(OVRInput.Button.SecondaryHandTrigger))
{
RaycastPointer();
}
}
private void RaycastPointer()
{
RaycastHit selection;
if (Physics.Raycast(pointerTransform.position,pointerTransform.forward,
out selection))
{
if (selection.collider.gameObject.CompareTag ("Ball"))
{
Destroy(selection.collider.gameObject);
}
}
}
}
作为变量pointerTransform,给出了GazeRing。
但是,如果我尝试用触发按钮“射击”球体。什么都没发生。
任何人都可以建议吗?
提前致谢!
解决方案
推荐阅读
- python - 循环函数并在每个循环python中存储不同的结果
- c# - 为什么 IIS Express 认为此 URL 具有双重转义序列?
- python - 需要比较两个文本文件并对它们进行排序,使用 Python
- javascript - 使用 setTimeout 进行柯里化 - JS
- r - How to draw bell curve of SD over a histogram in R?
- mysql - 如何解决外键约束失败的问题?
- c - 如何为多事的偶然事件添加 printf?
- angular - 从“@angunlar/material”导入 { DateAdapter };在角度 9 中找不到
- python - 在多个绘图中保持图例颜色相同
- integration - Travis 在拉取请求上将 pull_request_branch 添加到 slack 模板中