1
\$\begingroup\$

I am trying to get Samsung Gear VR(Oculus) rotation & position so when I turn the samsung controller left or right(like a magic wand)...it should give me rotation(Quaternion) & position(Vector3) readings?

How can I do that? I'm using Mobile version of Oculus Gear VR not the PC one. Also, GetLocalControllerRotation() returns void and doesn't return me a Quaternion

Does the controller come with a Gyroscope with the help of which I can the rotation or position readings?

\$\endgroup\$
0
\$\begingroup\$

There are two ways of doing it:

1. Using OVRCameraRig: it comes bundled with OVRManager and also transform components, here you can just place your mesh object into the RHandAnchor or LHandAnchor (depending on handedness) and rotational tracking will function as intended with no line of code needed.

2. Manualy: Here you should first place OVRManager Component in your scene, it is a singleton and required for tracking and also OVRInput class to function. Then you can set LocalPosition and LocalRotation of your wand object with

if (OVRInput.IsControllerConnected(OVRInput.Controller.RTrackedRemote))
            {
                wandObject.transform.rotation = OVRInput.GetLocalControllerRotation(OVRInput.Controller.RTrackedRemote);
                wandObject.transform.position = OVRInput.GetLocalControllerPosition(OVRInput.Controller.RTrackedRemote);

            }
| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.