Friday, November 10, 2017

AR Core today

We will be covering AR Core today!

If you want to do it-
You will need
1. a computer - PC or Apple
2. Pixel Smart Phone,  or a Galaxy 8 Smartphone

Download and install this-



///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Install everything!

On your phone

Enable developer options and debugging


Figure 1. Developer options
On Android 4.1 and lower, the Developer options screen is available by default. On Android 4.2 and higher, you must enable this screen as follows:
  1. Open the Settings app.
  2. (Only on Android 8.0 or higher) Select System.
  3. Scroll to the bottom and select About phone.
  4. Scroll to the bottom and tap Build number 7 times.
  5. Return to the previous screen to find Developer options near the bottom.
At the top of the Developer options screen, you can toggle the options on and off (figure 1). You probably want to keep this on. When off, most options are disabled except those that don't require communication between the device and your development computer.
Next, you should scroll down a little and enable USB debugging. This allows Android Studio and other SDK tools to recognize your device when connected via USB, so you can use the debugger and other tools.
The rest of this page describes some of the other options available on this screen.

///////////////////////////////////////////////////////////////////////////////////////////


Create a new project

In Unity, select File > New Project.
Name your project HelloAR, leave 3D mode selected, and click Create Project.

Import the SDK

Import the arcore-unity-sdk-preview.unitypackage by clicking the menu Assets > Import package > Custom Package and import everything in the Unity package.
In the Unity's Project window, you can see the both the Unity SDK files and the HelloAR sample app.

Configure the build settings

Open the Build Settings window by clicking File > Build settings.

Then, change the following settings:
  1. Change the target platform to Android and click Switch Platform.
  2. Click Player Settings to open the Android Player Settings. Then change the following settings:
    • Other Settings > Multithreaded Rendering: Off
    • Other Settings > Package Name: a unique app ID that looks like a Java package name, such as com.example.helloAR
    • Other Settings > Minimum API Level: Android 7.0 or higher
    • Other Settings > Target API Level: Android 7.0 or 7.1
    • XR Settings > ARCore Supported: On
  3. The Scenes in Build lists the scenes from your project that will be included in your build. Add the scene from the HelloAR sample app to the build as follows:
    1. Locate the scene in the Project window under Assets > GoogleARCore > HelloARExample > Scenes.
    2. Click the scene and drop it on Scenes in Build.

Build and run the sample app

Make sure your device is connected to your machine and then click Build and Run. Unity builds your project into an Android APK, installs it on the device, and launches it.

As you move your device, the app automatically detects flat surfaces and draws a diamond grid. Tap the grid to place an Android robot on the surface.
You can use Android Logcat to view log messages or Android Device Monitor to analyze the device more comprehensively.

No comments:

Post a Comment