Skip to content

Instantly share code, notes, and snippets.

@manbod
Last active February 5, 2018 21:11
Show Gist options
  • Save manbod/2ced3ae4404c52a2d150dd0e91ea9a95 to your computer and use it in GitHub Desktop.
Save manbod/2ced3ae4404c52a2d150dd0e91ea9a95 to your computer and use it in GitHub Desktop.
Create an AR scene that tracks planes. Clicking on a plane places a 3D Object on that spot.
/**
* Create an AR scene that tracks planes. Clicking on a plane places a 3D Object on that spot.
*/
@Override
public void onRendererStart() {
// Create the 3d ar scene, and display the point clouds.
mScene = new ARScene();
mScene.displayPointCloud(true);
// Create an TrackedPlanesController to visually display tracked planes
TrackedPlanesController controller = new TrackedPlanesController(this, mViroView);
// Spawn a 3D Droid on the position where the user has clicked on a tracked plane.
controller.addOnPlaneClickListener(new ClickListener() {
@Override
public void onClick(int i, Node node, Vector clickPosition) {
createDroidAtPosition(clickPosition);
}
@Override
public void onClickState(int i, Node node, ClickState clickState, Vector vector) {
//No-op
}
});
mScene.setListener(controller);
mViroView.setScene(mScene);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment