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\$
1
  • \$\begingroup\$ Why do you say GetLocalControllerRotation returns void? The docs define its return type as Quaternion, and this Oculus page specifically about GearVR development in Unity specs exactly this method for getting controller rotation: Quaternion rotation = OVRInput.GetLocalControllerRotation( OVRInput.Controller.RTrackedRemote); \$\endgroup\$
    – DMGregory
    Commented Aug 30, 2017 at 11:22

1 Answer 1

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);

            }
\$\endgroup\$
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .