Skip to content
This repository has been archived by the owner on Nov 8, 2019. It is now read-only.

Unable to gaze VideoUiView views #638

Open
AshishAccedo opened this issue May 28, 2019 · 0 comments
Open

Unable to gaze VideoUiView views #638

AshishAccedo opened this issue May 28, 2019 · 0 comments

Comments

@AshishAccedo
Copy link

Unable to gaze views like play, seek bar and etc inside VideoUiView class.
https://github.com/googlevr/gvr-android-sdk/blob/master/samples/sdk-video360/src/main/java/com/google/vr/sdk/samples/video360/VideoUiView.java#L157

Hi trying to get the gaze when any of custom Ui in front of eyes. like the play button, but nothing happens.

@OverRide
public void onDrawEye(Eye eye) {

  // Apply the eye transformation to the camera.
  Matrix.multiplyMM(view, 0, eye.getEyeView(), 0, camera, 0);

  Matrix.multiplyMM(viewProjectionMatrix, 0, eye.getPerspective(Z_NEAR, Z_FAR), 0, eye.getEyeView(), 0);
  scene.glDrawFrame(viewProjectionMatrix, eye.getType());
  if(isLookingAtTarget()){
    Log.e(TAG,"Bulls eye : ###################");
  }else{

  }
}

/**
* Check if user is looking at the target object by calculating where the object is in eye-space.
*
* @return true if the user is looking at the target object.
*/
private boolean isLookingAtTarget() {
// Convert object space to camera space. Use the headView from onNewFrame.
Matrix.multiplyMM(viewProjectionMatrix, 0, headView, 0, modelTarget, 0);
Matrix.multiplyMV(tempPosition, 0, viewProjectionMatrix, 0, POS_MATRIX_MULTIPLY_VEC, 0);

  float angle = Util.angleBetweenVectors(tempPosition, FORWARD_VEC);
  Log.e(TAG,"Angle : " +angle);
  return angle < ANGLE_LIMIT;
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant