SHARE
TWEET

Untitled

a guest Jun 16th, 2019 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @override
  2. public void onDrawEye(Eye eye) {
  3.  
  4.   // Apply the eye transformation to the camera.
  5.   Matrix.multiplyMM(view, 0, eye.getEyeView(), 0, camera, 0);
  6.  
  7.   Matrix.multiplyMM(viewProjectionMatrix, 0, eye.getPerspective(Z_NEAR, Z_FAR), 0, eye.getEyeView(), 0);
  8.   scene.glDrawFrame(viewProjectionMatrix, eye.getType());
  9.   if(isLookingAtTarget()){
  10.     Log.e(TAG,"Bulls eye : ###################");
  11.   }else{
  12.  
  13.   }
  14. }
  15. /**
  16. * Check if user is looking at the target object by calculating where the object is in eye-space.
  17. *
  18. * @return true if the user is looking at the target object.
  19. */
  20. private boolean isLookingAtTarget() {
  21. // Convert object space to camera space. Use the headView from onNewFrame.
  22. Matrix.multiplyMM(viewProjectionMatrix, 0, headView, 0, modelTarget, 0);
  23. Matrix.multiplyMV(tempPosition, 0, viewProjectionMatrix, 0, POS_MATRIX_MULTIPLY_VEC, 0);
  24.  
  25.   float angle = Util.angleBetweenVectors(tempPosition, FORWARD_VEC);
  26.   Log.e(TAG,"Angle : " +angle);
  27.   return angle < ANGLE_LIMIT;
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top