Forum Discussion
Anton111111
2 years agoExpert Protege
How understand what user use (seated or standing position)?
I want to show panel in front of user face. But when i try get OVRManager.profile.eyeHeight i've get about 1.65. How i understand it's some default value for standing position.
And how to get real eye position of user? Or maybe just undertand is user seating or standing and use two constants. But i can't find how understanding what mode user select (seated/without moving or standed)
9 Replies
Replies have been turned off for this discussion
- bilgekaganProtege
Some of the games I've worked on provide internal values for both standing and seating positions. They measure the head GameObjects world position center, with values typically ranging from 1.10 to 1.40 for seated positions and above 1.40 for standing positions.
Under OVRCameraRig/TrackingAnchor is a "CenterEyeAnchor" object that gets updated with the real-time position of the bridge of your nose. That should give you a good position to base your panel position from.
- Anton111111Expert Protege
Thanks π i found exactly the same soultion myself π
public class EyeLevel : MonoBehaviour { private void OnEnable() { #if !UNITY_EDITOR PlaceToEyeLevel(); #endif } private void PlaceToEyeLevel() { if (App.Instance.OVRCameraRig.centerEyeAnchor != null) { Transform centerEyeAnchor = App.Instance.OVRCameraRig.centerEyeAnchor; var calculatedY = ( centerEyeAnchor.position + centerEyeAnchor.forward * transform.position.z ).y; transform.localPosition = transform .localPosition .Let(it => { it.y = calculatedY; return it; }); } } }
- Anton111111Expert Protege
In additional i noticed that this solution sometimes works not good. CenterEyeAnchor. Has wrong Y (when i sit it returns wrong Y like i stand)
It's always right for me. If you want CenterEyeAnchor.transform.y to be the height from the floor, are you sure you're setting the tracking mode on the OVRManager to "floor"? Also - check that there's not some weirdness going on with the y offsets in the transforms of any parent transforms.
- Anton111111Expert Protege
Yep i'm sure. And i have issue only sometimes.
- Anton111111Expert Protege
I've made a little test.
I add the following code to write Y from centerEyeAnchor.position.y :
private void LateUpdate() { if (App.Instance.OVRCameraRig.centerEyeAnchor != null) { Transform centerEyeAnchor = App.Instance.OVRCameraRig.centerEyeAnchor; DebugArea.Info( "centerEyeAnchor: {0} {1}", centerEyeAnchor.position.y, centerEyeAnchor.forward.y ); } }And i see that Y changed from 1.01 to 1.7 when i rotate headset around X without changes headset position. And this is cause of my issue.
I'm happy to try your project in my environment if you want to make it available to me.
- Anton111111Expert Protege
My issue easy fixed. When i calculate Y i add forward vector and it afcouse move Y π It because i copy this part from another part of my code and forgot to delete it.
Here is fixed component:
public class EyeLevel : MonoBehaviour { private void OnEnable() { #if !UNITY_EDITOR PlaceToEyeLevel(); #endif } private void PlaceToEyeLevel() { if (App.Instance.OVRCameraRig.centerEyeAnchor != null) { Transform centerEyeAnchor = App.Instance.OVRCameraRig.centerEyeAnchor; var calculatedY = ( centerEyeAnchor.position + new Vector3(0f, 0f, transform.position.z) ).y; transform.localPosition = transform .localPosition .Let(it => { it.y = calculatedY; return it; }); } } }
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 3 years ago
- 5 months ago