Unity implements simple AR functions

1. First enter the Vuforia official website: Home | Vuforia EDP , or you can directly Baidu. The first step is to click to enter, register and log in.

2. Click develop to register for license management, and click the buttons in the two blue boxes in order to obtain a Key.

 

3. Enter the App name as shown below, agree to the terms, and confirm

 

 4. Click on the project you just created to generate the license key, which is required in the Unity project, which is the series in the red box in the picture below.

 

5. Create a Database, enter the name, and select the first type to create it. 

 

 

6. Click on the created Text

Add Target (Target is the recognized image file, in the format of .jpg or .png), and select a picture with clear contrast and high recognition. Image name must be in English

You can also replace the picture with a 3D object or something else. If you are interested, you can try it yourself. I will use pictures here.

 

 7. After the addition is successful, export the resources. After downloading, you will get a unity resource package. 

 The operation part on the website is completed. Next is the Unity part. I will not go into details about the new project. The plug-in can be downloaded from the official website just now. The next step is to import the plug-in and the resource package just downloaded. Just drag it directly to the Unity resource panel.

 

After importing the plug-in, there will be three folders 

Importing the resource package just downloaded will add two folders 

8. Find the two preset resources in the picture below, add them to the hierarchy panel, and delete the original camera in the scene.

 

9. Add an AR camera, configure the AR camera, click ARCamera, and click the button in the red frame below in the properties panel.

 

10. Paste the product key (in the red box in step 6) from the website just now to the location shown in the picture below, and set it to activation status. 

 

11. Set ImageTarget (drag into the second preset in the hierarchy panel), click, and operate on the properties panel as shown in the figure below, set Database and ImageTarget

 

Next, just drag the things you want to display in AR into sub-objects of the Image Target.

Here I created a sphere (blue), simply added an animation to make it rotate around the Y-axis, added a square (red) to make it appear to rotate, and then ran it.

I displayed the picture on the mobile phone, and pointed the computer camera at the picture on the mobile phone during operation. The Game window will display a rotating blue sphere on the picture seen by the camera, and it was successful.

You can also import cool models with animation into Unity and place them under Image Target, and you can also export apk Android files so that they can be displayed on your phone.

 

 

Guess you like

Origin blog.csdn.net/weixin_68665588/article/details/130532750