ashqal / MD360Player4Android

It is a lite library to render 360 degree panorama video for Android. VR Player.
Apache License 2.0
1.08k stars 357 forks source link

placing a hotspot at specific camera yaw & pitch #228

Open Hydrowind opened 6 years ago

Hydrowind commented 6 years ago

Hi! this library is so great.. thanks for sharing Ashqal!

i have a small problem. i'm not so good at math, i want to place multiple hotspots to a spesific yaw & pitch of the camera position. How to do that? i tried adding this code to consumePendingRotateToCamera() method:

        ```
        MDPosition position = getModelPosition();

        float[] rotation = new float[16];
        float[] yawMatrix = new float[16];
        float[] pitchMatrix = new float[16];
        Matrix.setIdentityM(yawMatrix, 0);
        Matrix.setIdentityM(pitchMatrix, 0);
        Matrix.rotateM(yawMatrix, 0, deltaYaw, 0, 1, 0);
        Matrix.rotateM(pitchMatrix, 0, deltaPitch, 1, 0, 0);

        Matrix.multiplyMM(rotation, 0, pitchMatrix, 0, yawMatrix, 0);

        position.setRotationMatrix(rotation);

But the it doesn't match the camera yaw & pitch position. I got the deltaYaw & deltaPitch value from VRLibrary().getDirectorBrief(). Does VRLibrary().getDirectorBrief().getYaw() & getPitch() returns the current camera yaw & pitch position?

Thanks in advance!