检测 Oculus Quest 1 &Unity 中的 2 个耳机 [英] Detect Oculus Quest 1 & 2 Headsets in Unity
问题描述
我正在寻找一种方法来检测在我的 VR 应用中使用的耳机的名称.我需要区分 Quest 1 &2 以实现不同的控制器映射.像 XRDevice.model 或 OVRPlugin.productName 这样的方法在文档中没有提供任何名称列表,并且由于 quest 2 是一个新模型,我在任何地方都没有找到有关它的信息.任何帮助将不胜感激.
I'm looking for a way to detect the name of the headset being used in my VR app. I need to distinguish between the Quest 1 & 2 in order to implement the different controller mappings. Methods like XRDevice.model or OVRPlugin.productName don't provide any name lists in the documentation and since the quest 2 is a new model I haven't found information on it anywhere. Any help would be appreciated.
推荐答案
如果您直接在 Quest 2 上运行(而不是 Oculus Link),您可以使用
If you are running on the Quest 2 directly (as opposed to Oculus Link) you can use
OVRPlugin.SystemHeadset headset = OVRPlugin.GetSystemHeadsetType();
if(headset==OVRPlugin.SystemHeadset.Oculus_Quest){
// Quest 1 stuff here
}else if (headset==(OVRPlugin.SystemHeadset.Oculus_Quest+1)){
// Quest 2 stuff here
}
他们还没有将 Oculus Quest 2 添加到 SystemHeadset 枚举中,但它有一个Placeholder_9"在它的位置.我只是更喜欢+1"为清楚起见.
They haven't added Oculus Quest 2 to the SystemHeadset enum yet, but it has a "Placeholder_9" in its place. I just prefer the "+1" for clarity.
如果您使用该链接,它会为 Quest 1 返回 Oculus_Link_Quest,我假设 Quest 2 为 (Oculus_Link_Quest+1).但我还没有确认这一点.
If you are using the link, it will return Oculus_Link_Quest for Quest 1 and I assume (Oculus_Link_Quest+1) for Quest 2. But I haven't confirmed that.
截至 2020 年 12 月 6 日,Quest1 和 Quest2 均返回Oculus_Link_Quest";如果您使用的是 Oculus Link.
As of 2020-12-06, both Quest1 and Quest2 return "Oculus_Link_Quest" if you're using Oculus Link.
这篇关于检测 Oculus Quest 1 &Unity 中的 2 个耳机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!