Unity3D 获取 OVRCameraRig 的位置 [英] Unity3D Getting position of OVRCameraRig

查看:105
本文介绍了Unity3D 获取 OVRCameraRig 的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一个对象附加到 OVRCameraRig 上,然后使用它的位置,该位置偏离了装备.

I want to attach an object to the OVRCameraRig and then use its position, which is offset from the rig.

但是,无论头戴设备在哪里,我的对象始终是静态的.

However, my object is always static, irrespective of where the headset is.

这只发生在 OVRCameraRig 上.如果我使用普通的 MainCamera,我会得到正确的数据.但我没有得到 OVRCameraRig 的其他方面,例如地板高度!

This only happens with the OVRCameraRig. If I use a normal MainCamera I get the right data. But I'm not getting other aspects, like floor level, of the OVRCameraRig!

有什么办法可以得到 OVRCameraRig 的实际位置吗?

Is there some way to get the actual position of the OVRCameraRig?

推荐答案

Afaik OVRCameraRig 本身不会移动.

Afaik the OVRCameraRig itself doesn't move.

你可能想得到的是 代替

What you probably want to get is the position of the centerEyeAnchor instead

// somehow get the reference e.g. using GetComponent
OVRCameraRig overCameraRig;

var position = overCameraRig.centerEyeAnchor.position;

无论usePerEyeCameras 的值如何,centerEyeAnchor 的位置总是更新.

Regardless of the value of usePerEyeCameras the centerEyeAnchor's position is always updated.

这篇关于Unity3D 获取 OVRCameraRig 的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆