Skip to content

Instantly share code, notes, and snippets.

View burakiren's full-sized avatar

Burak burakiren

View GitHub Profile
@burakiren
burakiren / ArEngineControl.java
Created November 24, 2020 12:10
arengine control
boolean isInstallArEngineApk = AREnginesApk.isAREngineApkReady(this);
if (!isInstallArEngineApk) {
// ConnectAppMarketActivity.class is the activity for redirecting to AppGallery.
startActivity(new Intent(this, com.huawei.arengine.demos.common.ConnectAppMarketActivity.class));
isRemindInstall = true;
}
@burakiren
burakiren / ArSessionCreate.java
Created November 24, 2020 12:11
Create Ar Session
//Create an ARSession.
mArSession = new ARSession(this);
//Select a specific Config to initialize the ARSession based on the application scenario.
ARWorldTrackingConfig config = new ARWorldTrackingConfig(mArSession);
mArSession.configure(config);
mArSession.resume();
@burakiren
burakiren / HandleResult.java
Created November 24, 2020 12:12
Handle Result
//Obtain a frame of data from ARSession.
ARFrame arFrame = mArSession.update();
//Obtain the ARCamera object from the ARFrame object. The ARCamera object can obtain the projection matrix of the camera to render the window.
ARCamera arCamera = arFrame.getCamera();
//Obtain all trackable planes from ARSession.
Collection<ARPlane> arPlanes = mArSession.getAllTrackables(ARPlane.class);
@burakiren
burakiren / HitTest.java
Created November 24, 2020 12:13
Hit Test
//Pass the click event to the ARFrame object and generate the hit detection result.
List<ARHitResult> hitResults = arFrame.hitTest(motionEvent);
//Create an anchor at the detected hit location to enable the AR Engine to continuously track the location.
for (ARHitResult arHitResult : hitResults) {
arHitResult.createAnchor();
}