In past lectures we've discussed having multiple trackers and when you get to the point of trying to
find more than six images then your image try to start to complain and it will also affect the performance.
So you want to try and arrange your project so that if you do need to pick up lots and lots of different
images that you somehow group for them and then have them separately so that you can turn some off and
some on and then reverse that in different situations.
So in this lecture I'm going to show you how to do that.
We're going to have to image trackers.
So create yourself a new project bring in the wicked chewed stuff and we're going to add in a wicked
chewed camera and two image trackers.
Now I've created an image track of one called Image tracker cars and the other image tracker dog I know.
So we're just again going into a search and putting in image tracker to find our prefab drag that in
twice.
Then underneath that let me just drive that in and you can see what you get.
So this is our fault when we get under that you get you trackable.
And so you just duplicate that how many times.
Three times and one car one car to car three and the other set Daryn.
One two three and four.
Now the wicked shoot comes with a really nice set of dinosaur trackers that have already been trained
for you and you'll find those in your streaming assets.
We could shoot attached to this lecture as resorts.
You're going to find another WTC fall called classic cars and you want to bring that in and put it in
your streaming assets like a chewed folder.
Along with that you'll also get ice set of cat images that you can use as markers.
So we're going to set up one of the image trackers in the hierarchy with four dinosaurs from the dawn
set and one from the cause.
So the image tracker cause should have the Target collection set too.
We could shoot slash classic caused the WJC and the dinosaur one should have we could choose slash dinosaurs.
Say now the age of the cause.
The actual trackers themselves the cow one is going to take for the blue car or the first car and it's
durable will be cash for now.
You don't have these prefabs for these cars yet.
You'll need to download them from the asset store.
Now you could use cubes of different colors if you want to.
For this but I've found some for a cause in the unity assett store and I downloaded those and you can
see those currently on the screen now in there there were prefabs for eight of those cause when I downloaded
them I got this rising cause pack folder and there were prefabs in so they let me just show you these
particular ones that I used.
Now I just grabbed ones that matched the color of the car on the Mac is not necessarily the same Mike
because that wasn't available.
But for if I just select that for mine to show these cars were really huge.
So what I had to do over in the inspect again was scaled down the prey Fab's so that they fit onto the
markers.
And of course you can do that yourself through the process of selecting the image tracker turning on
the preview for that going over into the scene.
I can find that
just there and drag and dropping your item onto it just to see what the scale will be like when it gets
drawn.
Right so I'm just going to remove that off.
So you should be familiar with this process by now.
So set up your three different cars with a different image on them and with a different drawable item
for the dinosaurs you want to set age of the dinosaurs to a different images.
Well now the dinosaurs are different colors and different types of dinosaurs.
We could come up with ways inside of it's samples.
So if we go down into the assets and have a look in we could choose samples and we want to go down to
sample prefabs and there's a dinosaur folder in there you will find each of these dourness or so you
just have to drag and drop those daurna source over onto the durable for H associated Mocca.
So with these two image trackers on let's press play and have a look at what we get.
So I've got all of my markers like that so that we can test them at least try to.
We can pick up a CA
OK so there's the Ca.
And now let's try one of the dinosaur markers.
So it's not picking up this dinosaur marker.
Let me just show you what's happening I'm going to pose this.
We have a look at the image tracker for the Dawna's if you selected in the hierarchy have a look in
the Special say that the image check a script is on tape.
If you click on the cars you'll see that the cars in each track the script is ticked.
Now if you stop playing and then have a look at both these items the cars Aimee's is ticked.
The Dawna Emmie's checkers tick.
What's happening is that wicked chewed will not allow you to have more than one image tracker and idled
at a time.
So therefore it turns one off and it's turning off any that it finds after the very first one.
So therefore we can have them on the same time.
But what we can do is program all application to switch between them and then have them on for the different
sets of markers when we want them to be on.
And that way we can reduce the amount of processing that we could shoot camera is doing in trying to
pattern match any images.
Now in order to turn these image Trickers on and off again to create a little bit of a graphical user
interface in here.
So I've got this project actually set to Android mode so that I can build it out later on you don't
have to you can do this in the editor as well and it's on a landscape so I'd hold the phone in the sort
of direction if I was using this which is kind of irrelevant but that's just the way I've got it set
up.
Now we're going to add some buttons so to the hierarchy right click go down to UI and click on button.
Now the button is going to appear in the center of the screen just there.
Before we do anything else you want to click on your canvas then find that canvas Skyla and change it
from constant pixel so as to scale with the screen size so that we can then put on different devices
of different resolutions and we will get the same scale in our button.
This button is going to be the car button.
So I'm just going to rename it in the hierarchy so we know which one it is.
Then if you just drop down the little triangle next to the button is a text area and in it you'll find
a button written for text.
We want to put the word cowardness or that appears on an button.
Now this button I want to push down into this bottom left hand corner.
So click on the button.
I'll go over to the recked transform.
Click on that.
Then I want to click once in the bottom left and I want to option or alt click again to push it down
into that bottom corner.
Now we're going to do the same thing with another button but we will call it the No button.
So I'll leave that as a quick challenge for you.
Pause video now go back and do that.
And when we come back all run through quickly putting that in so to create the don't know button you
can simply grab hold of the button and just control the.
And duplicate it.
But you also have to rename it so we know it's a different person and let's call diner.
Boston also then going to change the text on it to diner.
And with the button itself we want to anchor it in position at Dan in the opposite corner so that we
can see it so click down there and then I will option alt down there as well.
So now that I have those two different buttons that will control turning on and off the respective markers.
Right so to go along with that will also add in a little display of the markers themselves so that when
we click on the car across the top of the screen we'll see those images select Joe canvas.
We're going to right click and go down to UI and find a panel.
So drop a panel in there the panel is going to take up the entire gooey area which you don't want we
just want to be at the top so find your panel over in the 2d version of the scene view and click on
the button with the little dots on the corner so that you can resize it and just drag it up like that
to sort of position it there.
Now at the same time you might want to anchor it to the top so click the panel click the transform and
then you also want to click the top like that and we want to option click the top as well.
Now you can stretch it across if you want it to remain stretched as it is let's just have a quick look
at it.
It's going to court Knowsley for us.
So let's rename that to car panel and then with the car panel we want to add a component which is a
grid layout group that will help you organize any images that automatically get placed on he or I should
say it will automatically organize images that get placed on there.
Now with the panel we're going to now add three roll images one for each of our image markers.
So let's say right click on the car panel and go you my raw image and you'll get one on the corner there.
And then you can just control day that twice to get to more and then rename knows kawan
cut to and three.
OK so one of those can now take on an image from that cause fold up that I gave you in the Downloads
was this lecture so just drag and drop one of the textures on each one to sit those cars up.
And then once we've done that we want to click back on the car panel and just a line these in the center.
So Gushue greed liar group which is already lying out for you.
But we want some spacing between HLS put in the X spacing and then to get them in the center.
Let's go to child alignment and click on middle center and that will move them across for you and keep
them there when you raise size then the more you add to this it will also push demand from both sides
and keep it centered.
So that's the car panel.
Now we want an identical panel for the dinosaurs and we want it pretty much in the same place.
So you couldn't duplicate that and then add the dinosaurs.
They'll be on top of each other.
So to see the dinosaurs themselves you could actually select that panel and go right at the top and
just turn it off in the inspector for now so that they're not sort of competing for screen space.
So again I'll leave that with you as a mini challenge.
Pause the video when we come back I'll quickly go through adding those in let's race through an ad in
this day and a panel so the car panel I'm going to clone that so Control D and then I'm going to cool
the darn panel.
On a panel and spell it for the panel which is already there.
I'll just turn that off so we don't have the interrupting anymore.
Let's drop down the existing Dawn panel and we will rename the east to dawn.
Juan and then Donna to
three
and we need a fourth one so I'll just duplicate that last one.
Cool Dawn are for.
And at the same time I want to select each one and change the image that's on.
Now if you had a look through the we could chewed things in the samples.
There's also a target images and that's got all the samples of the targets that you can print out in
it.
So we want to go to Dawn I want and just drag and drop the blue Dawna's saw then we're going to put
the orange down.
So I guess it doesn't really matter about the order of these is just displaying what markers you will
be able to pick up in the different modes.
OK so now we have the don't know they're on the panel and we can turn that off turn the cow back on
or off like that.
So I'm going to leave them both off to start with the both buttons on.
And now we're ready to write some code to hook all this stuff together.
All right.
So let's go back up into the assets and we're going to add in a new sea shop.
Let's call this our control law code we also want to add an object into the hierarchy that can hold
that script so we'll select a 3D object.
Actually no you can't just create an empty object and let's call that control lock because it doesn't
need anything on it and it doesn't need to be anywhere in particular.
Let's drag and drop the controller code on to the ready to go.
Now let's open that up.
The control code needs to know about the image trackers and it also needs to know about the little panels
that we've created so that it can turn them on and off.
So what we're going to do to begin with is at the top make sure that you add using we could choose.
Otherwise it's not going to recognize some of these objects that we create.
So the first one will be a public image tracker and that will be the car tracker and we also need another
one or just copy that and paste it and that will be at dawn or tracker and we're going to also add in
public game objects.
Which will be the panel for the kaso car panel and public game object don't-I panel.
Right so save that and we'll just switch back into unity find your controller and that script that's
on it.
The card tracker if you want to drag the image tracker for cars onto that position the doner tracker
it's the image tracker daurna goes on to the car panel takes the car Penno remember we've got both of
those turned off.
That's OK.
Just drag and drop that into the car panel and the panel drag and drop that into the Dawna panel position.
OK.
When we come back in part two of the Select Chow will start adding the functionality into the code.