ViveSoftware / ViveInputUtility-Unity

A toolkit that helps developing/prototyping VR apps.
http://u3d.as/uF7
Other
352 stars 82 forks source link

GetAngularVelocity does not work #152

Closed skelder closed 4 years ago

skelder commented 4 years ago

VivePose.GetAngularVelocity returns 0,0,0 vector3. Is there any specific way it should be accessed?

chengnay commented 4 years ago

@skelder Which device you are using? Could you provide more detailed information? For which platform(PC, Android, Oculus or OpenVR devices), any other SDKs(versions) imported to your project and which version of VIU?

skelder commented 4 years ago

Sorry for lack of information

Devices used for testing: Vive Pro with 2 vive controllers OS: windows PC Additional SDK: oculus integration due to the fact that I have to ship this to oculus quest in the end And No steamVR if its important VIU version : 1.10.4.0 from the asset store

skelder commented 4 years ago

I tested with newest version 1.10.6 as well but it just kept on reporting 0 vector No matter where I checked on Update or FixedUpdate

chengnay commented 4 years ago

@skelder Previously, Unity 2017.1 and before does not have angular velocity API. If you have using Unity 2017.2 or newer, please modify the following script to enable the GetAngularVelocity API. Under Assets\HTC.UnityPlugin\VRModule\Modules\UnityEngineVRModule_2017_1.cs, after line 269, add

if UNITY_2017_2_OR_NEWER

            var angularVelocity = default(Vector3);
            if (m_nodeStateList[i].TryGetAngularVelocity(out angularVelocity)) { currState.angularVelocity = angularVelocity; }

endif

Please let me know if you still have issue.

skelder commented 4 years ago

Great now it seems to work! Thanks a lot.

Was there any specific reason to not include the angular velocity in those files in the latest release or was it just a omission during the update?

skelder commented 4 years ago

Also this is not really related to the problem, but I was curious about the difference between the Getvelocity and the GetVelocityEx.

I could not find the documentations about it and looking at the code just confused me even further.

What is the exact difference between them?

chengnay commented 4 years ago

Great now it seems to work! Thanks a lot.

Was there any specific reason to not include the angular velocity in those files in the latest release or was it just a omission during the update?

We didn't notice that Unity provides angular velocity API in Unity 2017.2 and newer version.

Also this is not really related to the problem, but I was curious about the difference between the Getvelocity and the GetVelocityEx.

I could not find the documentations about it and looking at the code just confused me even further.

What is the exact difference between them?

API ending with Ex is a generic API which can use for TrackerRole. For example, VivePose.GetAngularVelocity(TrackerRole.Tracker1), this will have compile error But, VivePose.GetAngularVelocityEx(TrackerRole.Tracker1) will work

skelder commented 4 years ago

Thanks a lot!