private void hideObject(){
  float[] rotationMatrix=new float[16];
  float[] posVec=new float[4];
  float angleXZ=(float)Math.random() * 180 + 90;
  Matrix.setRotateM(rotationMatrix,0,angleXZ,0f,1f,0f);
  float oldObjectDistance=objectDistance;
  objectDistance=(float)Math.random() * (MAX_MODEL_DISTANCE - MIN_MODEL_DISTANCE) + MIN_MODEL_DISTANCE;
  float objectScalingFactor=objectDistance / oldObjectDistance;
  Matrix.scaleM(rotationMatrix,0,objectScalingFactor,objectScalingFactor,objectScalingFactor);
  Matrix.multiplyMV(posVec,0,rotationMatrix,0,modelCube,12);
  float angleY=(float)Math.random() * 80 - 40;
  angleY=(float)Math.toRadians(angleY);
  float newY=(float)Math.tan(angleY) * objectDistance;
  modelPosition[0]=posVec[0];
  modelPosition[1]=newY;
  modelPosition[2]=posVec[2];
  updateModelPosition();
}

private void hideObject ( ) { float [ ] rotationMatrix = new float [ 16 ] ; float [ ] posVec = new float [ 4 ] ; float angleXZ = ( float ) Math . random ( ) * 180 + 90 ; Matrix . setRotateM ( rotationMatrix , 0 , angleXZ , 0f , 1f , 0f ) ; float oldObjectDistance = objectDistance ; objectDistance = ( float ) Math . random ( ) * ( MAX_MODEL_DISTANCE - MIN_MODEL_DISTANCE ) + MIN_MODEL_DISTANCE ; float objectScalingFactor = objectDistance / oldObjectDistance ; Matrix . scaleM ( rotationMatrix , 0 , objectScalingFactor , objectScalingFactor , objectScalingFactor ) ; Matrix . multiplyMV ( posVec , 0 , rotationMatrix , 0 , modelCube , 12 ) ; float angleY = ( float ) Math . random ( ) * 80 - 40 ; angleY = ( float ) Math . toRadians ( angleY ) ; float newY = ( float ) Math . tan ( angleY ) * objectDistance ; modelPosition [ 0 ] = posVec [ 0 ] ; modelPosition [ 1 ] = newY ; modelPosition [ 2 ] = posVec [ 2 ] ; updateModelPosition ( ) ; }
find a new random position for the object . < p > we ' ll rotate it around the y - axis so it ' s out of sight , and then up or down by a little bit .
