0

I am developing Android VR Application using 'Gear vr Framework'.

I want to get the head tracking value that can be used in Quaternion. (OrientationXYZW,PositionXYZ,linearVelocityXTZ, angularVelocityXYZ,.. etc. not camera value!(roll,yaw,pitch)).

I was able to get head tracking values Using judax's OculusMobileSDKHeadTracking library in the 'Gearvr framework (GearVRf v3.0.1 - Oculus Mobile SDK 1.0.3)'.

Judax's OculusMobileSDKHeadTracking github: [https://github.com/judax/OculusMobileSDKHeadTracking]

However, it was not possible with GearVRf v3.1 (Oculus Mobile SDK 1.0.4).

Because judax OculusMobileSDKHeadTracking uses Oculus Mobile SDK v.1.0.3. So, 'GearVRf v3.1' is having trouble getting head tracking values due to version conflicts.

Judax's OculusMobileSDKHeadTracking can be modified and used(Get positionXYZ, HeadDepth, etc.), but it is not easy to deal with JNI and NDK.

Is there a way to get headtracking values from the Gearvr framework? Or, please recommend other open source libraries.

4

2 回答 2

1

能不能用 http://docs.gearvrf.org/v3.1/Framework/org/gearvrf/GVRCamera.html 的getTransform(),然后getRotationX(),getRotationY(),getRotationZ(),getRotationW()得到四元数?

于 2017-03-13T17:25:54.903 回答
0

实际上,正如前面的答案 (+1'd :)) 所暗示的,四元数可以通过适当GVRTransform的 's getRotationX, ...getRotationZ方法获得。这是一个可能有助于实现的片段:

public class SomeViewManager extends GVRMain {

    private GVRTransform mHeadTransfom;
    private HeadListener mHeadListener;

    MovieViewManager(HeadTransformListener headListener) {
        mHeadListener = headListener;
    }

    @Override
    public void onInit(GVRContext gvrContext) {
        GVRScene scene = gvrContext.getMainScene();
        mHeadTransfom = scene.getMainCameraRig().getHeadTransform();
    }

    @Override
    public void onStep() {
        mHeadListener.onOrientation(
                mHeadTransfom.getRotationW(),
                mHeadTransfom.getRotationX(),
                mHeadTransfom.getRotationY(),
                mHeadTransfom.getRotationZ()
        );
    }
}

public interface HeadTransformListener {
    public void onHeadTransform(float w, float x, float y, float z);
}

在我的情况下,目标是将头部方向传递给FB360(以前的“TwoBigEars”)音频渲染器,用于空间音频,以下使用 v0.9.95 实现了这一点com.twobigears.TBAudioEngine

public class SomeActivity extends GVRActivity implements HeadTransformListener  {
    @Override
    public void onHeadTransform(float w, float x, float y, float z) {
        // Set orientation
        TBAudioEngine.setListenerOrientation(new TBQuat(w, x, y, z));
    }
}
于 2017-05-17T01:55:16.353 回答