Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by luiziv · Feb 01, 2021 at 10:18 PM · vroculussteamoculus rift

How does VR controller position works?

I'm trying to understand what position I get when I try to get vr devicePosition/deviceRotation. Seems like every hmd model returns the position in a different way. I have also noticed that when using steam vr all models return positions in a common pivot, so that whatever the model you're using the your hand will feel right.

My real question here is if there's an "offsets table" that I could use to make all devicePosition/rotation return something that's similar and not completely different from one device to another. Is this documented anywhere? It's being very hard to make my hand model match in every platform without using steamvr, I'll have to have an offset for each device, which I'll have to deduce manually.

In this image attached I have the oculus rift s controller model for steam vr and the official model, they have quite a big offset.alt text

Also, the same problem happens for windows mixed reality

offset.png (132.2 kB)
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image eblavender · Mar 29, 2021 at 11:01 AM 0
Share

I am having the same issue using OpenXR and the new Input System. All Oculus and Vive controllers work fine, but WMR and the Valve Index differ somehow, resulting in incorrect offsets for my hands :(

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by eblavender · Jan 19 at 10:51 AM

@Chimer0s I had to do this manually unfortunately, but i made this script that will set offsets for you based on the controller type. See image for values.alt text

 using System.Collections.Generic;
     using UnityEngine;
     using UnityEngine.XR;
     
     public class OpenXRHandOffset : MonoBehaviour
     {
         [SerializeField] private Transform leftOffset, rightOffset;
     
         [Header("Oculus")]
         [SerializeField] private Vector3 oculusPosition;
         [SerializeField] private Vector3 oculusRotation;
     
         [Header("Windows MR")]
         [SerializeField] private Vector3 windowsPosition;
         [SerializeField] private Vector3 windowsRotation;
     
         [Header("Index")]
         [SerializeField] private Vector3 indexPosition;
         [SerializeField] private Vector3 indexRotation;
     
         [Header("Vive")]
         [SerializeField] private Vector3 vivePosition;
         [SerializeField] private Vector3 viveRotation;
     
         void OnEnable()
         {
             InputDevices.deviceConnected += DeviceConnected;
             List<InputDevice> devices = new List<InputDevice>();
             InputDevices.GetDevices(devices);
     
             foreach (var device in devices)
                 DeviceConnected(device);
         }
         void OnDisable()
         {
             InputDevices.deviceConnected -= DeviceConnected;
         }
     
         void DeviceConnected(InputDevice device)
         {
             // The Left Hand
             if (device.characteristics == 0)
                 return;
     
             if (device.name.Contains("Oculus"))
             {
                 leftOffset.localPosition = new Vector3(-oculusPosition.x, oculusPosition.y, oculusPosition.z);
                 leftOffset.localEulerAngles = new Vector3(oculusRotation.x, -oculusRotation.y, -oculusRotation.z);
                 rightOffset.localPosition = oculusPosition;
                 rightOffset.localEulerAngles = oculusRotation;
             }
             else if (device.name.Contains("Windows"))
             {
                 leftOffset.localPosition = new Vector3(-windowsPosition.x, windowsPosition.y, windowsPosition.z);
                 leftOffset.localEulerAngles = new Vector3(windowsRotation.x, -windowsRotation.y, -windowsRotation.z);
                 rightOffset.localPosition = windowsPosition;
                 rightOffset.localEulerAngles = windowsRotation;
             }
             else if (device.name.Contains("Index"))
             {
                 leftOffset.localPosition = new Vector3(-indexPosition.x, indexPosition.y, indexPosition.z);
                 leftOffset.localEulerAngles = new Vector3(indexRotation.x, -indexRotation.y, -indexRotation.z);
                 rightOffset.localPosition = indexPosition;
                 rightOffset.localEulerAngles = indexRotation;
             }
             else if (device.name.Contains("Elite")) //Cosmos Elite
             {
                 leftOffset.localPosition = new Vector3(-vivePosition.x, vivePosition.y, vivePosition.z);
                 leftOffset.localEulerAngles = new Vector3(viveRotation.x, -viveRotation.y, -viveRotation.z);
                 rightOffset.localPosition = vivePosition;
                 rightOffset.localEulerAngles = viveRotation;
             }
             else if (device.name.Contains("Cosmos")) //Cosmos
             {
                 leftOffset.localPosition = new Vector3(-oculusPosition.x, oculusPosition.y, oculusPosition.z);
                 leftOffset.localEulerAngles = new Vector3(oculusRotation.x, -oculusRotation.y, -oculusRotation.z);
                 rightOffset.localPosition = oculusPosition;
                 rightOffset.localEulerAngles = oculusRotation;
             }
             else if (device.name.Contains("HTC")) // Vive
             {
                 leftOffset.localPosition = new Vector3(-vivePosition.x, vivePosition.y, vivePosition.z);
                 leftOffset.localEulerAngles = new Vector3(viveRotation.x, -viveRotation.y, -viveRotation.z);
                 rightOffset.localPosition = vivePosition;
                 rightOffset.localEulerAngles = viveRotation;
             }
             else
             {
                 print(device.name + " does not exist in the current offset list");
                 return;
             }
     
             OnDisable();
             print(device.name);
         }
     }



openxr-offset-values.png (57.0 kB)
Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Chimer0s · Jan 21 at 03:10 PM 0
Share

Yeah I figured there wouldn't already be one. I actually came up with the same solution basically and have decided to get the values manually myself, as well. Thanks for sharing your solution and values!

avatar image luiziv · Jan 21 at 03:25 PM 0
Share

Same here, had to find out the best values manually

avatar image
0

Answer by Chimer0s · Jan 19 at 03:30 AM

Out of curiosity did you ever find the resource you were looking for with the offsets for each controller type? I'm in the same boat. I loved how SteamVR automatically aligned the controllers depending on their manufacturer. I'm disappointed to see that OpenXR doesn't.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

203 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Mechanics in VR? 0 Answers

Touch controllers Steam VR not showing 0 Answers

I can't access play mode with Oculus 0 Answers

(XR Input) Why does Oculus Rift work fine, but HTC Vive inputs stays at 0 ? 0 Answers

How to move a player to a set position in vr 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges