Modifying the AR scene

In this section, we are going to modify the current AR scene by adding a new ImageTarget. To do this, we will follow the same steps that we followed in the previous section:

  1. From the resources of the project, drag the Target_Prince.jpg image into the Assets/StreamingAssets folder.
  2. Then, drag the Target_Prince_texture.jpg image into the Assets/@MyAssets/Images folder:

Target_Prince and Target_Prince_texture in their respective folders
  1. Then, drag the Prince folder, which contains the model, into Assets/@MyAssets/Models:

The prince model
  1. Right-click the ImageTarget and select Duplicate so that we can use it as template for the new ImageTarget:

Duplicating the ImageTarget
  1. Rename the first ImageTarget to ImageTargetMaia and the current one to ImageTargetPrince so that you can distinguish between them. Move them on the scene so that they don't overlap.
  2. Copy the following Target Name and Path parameters into the Image Target Controller of our ImageTargetPrince in the Inspector window:
 
Image Target Controller parameters
  1. Drag the Target_Prince_texture.jpg image from the Assets/@MyAssets/Images folder onto the Project window to the Quad of ImageTargetPrince in the Hierarchy window in order to apply it as a texture.
  2. Remove the maia model from ImageTargetPrince (right-click and Delete) and drag the prince model there instead.
  3. Move, rotate, and scale the prince model until it's in the middle of the marker and looks good.

The following screenshot shows our scene with the two ImageTargets and their respective seats:

The scene with the two targets and models
  1. Before testing our scene, let's hide the Quad objects so that they don't appear in AR and we only see the chairs. For that, select both Quad GameObjects (Ctrl + left click for multiple selection) and uncheck their Mesh Renderer components:

Hiding the Quad GameObjects
  1. Now, hit play to test that everything is set up correctly. Point with the camera to one of the targets and then to the other to see the chairs.
  2. Hit play again to stop the simulation and continue making changes.
  3. At the moment, ImageTracker of the EasyAR_Setup GameObject has been set to detect only one marker at a time. Let's increase this value to 2 so that our users can see both chairs together:
Changing the number of simultaneous targets

Now, test this out—you should see both chairs appear at the same time.

The next thing we need to do is create the script that will let the user change the textures of the seats.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.240.21