Exemplo n.º 1
0
  @Override
  protected void loadContents() {
    try {
      // Getting a file path for tracking configuration XML file
      String trackingConfigFile = AssetsManager.getAssetPath("TrackingData_MarkerlessFast.xml");

      // Assigning tracking configuration
      boolean result = metaioSDK.setTrackingConfiguration(trackingConfigFile);
      MetaioDebug.log("Tracking data loaded: " + result);

      // Getting a file path for a 3D geometry
      String robotModel = AssetsManager.getAssetPath("RB-BumbleBee.obj");
      if (robotModel != null) {
        // Loading 3D geometry
        model = metaioSDK.createGeometry(robotModel);
        if (model != null) {
          // Set geometry properties
          Vector3d scale = new Vector3d(0.3f, 0.3f, 0.3f);
          Vector3d translation = new Vector3d(-300f, -200f, 0f);
          Rotation rotation = new Rotation(0f, 0f, -(float) Math.PI / 2f);

          model.setRotation(rotation);
          model.setScale(scale);
          model.setTranslation(translation);

          model.setName("RB-BumbleBee");

          mGestureHandler.addObject(model, 1);
        } else {
          MetaioDebug.log(Log.ERROR, "Error loading geometry: " + robotModel);
        }
      }

      String extra = AssetsManager.getAssetPath("metaioman_target.png");
      if (extra != null) {
        imageModel = metaioSDK.createGeometryFromImage(extra, false, true);
        if (imageModel != null) {
          Vector3d v = new Vector3d(0f, 0f, 0f);
          imageModel.setTranslation(v);
          mGestureHandler.addObject(imageModel, 2);
        } else {
          MetaioDebug.log(Log.ERROR, "Error loading geometry: " + imageModel);
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 2
0
 @Override
 public boolean onTouch(View v, MotionEvent event) {
   super.onTouch(v, event);
   mGestureHandler.onTouch(v, event);
   return true;
 }