In this lecture we're going to look at making multiple target images and having them in the one library
for them one takes a file and then using them in a single project to identify different objects with
those markers.
So we start with a three day project.
Now into this project I've brought these vehicle tools packed that we'll be using.
We're going to create a mini magazine mini car magazine our way.
Each page has a different car that's going to come up and be augmented that you can also drive around.
So this is the vehicle tools you can find it in the asset store it's made by unity.
It's FREE.
Bring this in first because when it comes in says it's going to override everything so you want to actually
go to Mt project to start with.
Then you're going to have to bring in the wicked chewed package as well.
Drag and drop that in and for this we also need our cross platform import tools.
Now they ah and assets import package and then cross platform import.
So do all of those things then we're going to go into a studio.
Once you've logged into we could choose Juday we're going to add a project here we're going to give
it a name so let's just put car magazine and we want it to be an image tie.
Create.
Once it's created will then pop in there you want to get hold of the zit fall that's attached as a resource
to this lecture.
Inside you'll find three JPEG images.
There's one for sports car one for family car and one for truck.
Inside of this project a car magazine you want to add image targets.
Now you can pick up those three pick falls and drag and drop them onto these books in the browser.
Once they there just hit on upload that will bring them into like it should then it will process them
all and create three separate markers but bundle them into the one WTC file.
All right so you can say the three of them there they all Rached three stars.
So that's good.
Now when you click on WTC it will then bring up the e-mail again saying that your WTC follow the e-mail
to you.
Check your e-mail.
Grab hold of that file.
Then if it's called something like track of 5 or whatever strikes just rename it to something you familiar
with and then we'll go back to unity backing unity.
You want to bring your WTC fallings that goes into your streaming assets.
We could choose folder like that.
Now we're ready to build our application so you no hierarchy we're going to add in an object but the
Wiki camera then we want to add in our image tracker just like we've done before.
The image check at this time we're going to assign that to our CA magazine WTC at least that's what
I've called mine.
So Dan in that Target collection we drop that down and we find out car magazine and put that in.
Now what you're going to notice once you've done that and you would have seen this with the dinosaur
example before under trackable you will find all of the markers and they're all turned on.
We don't want them turned on.
On the one trackable object so that each trackable object you can only have one drawable Autum that
main's.
We need to grab this trackable object and hit Control day twice to create three versions of it.
The first one let's rewind that to family
CA.
The next one let's find that to sports.
And the third one will need to truck right now at the moment.
They've all got eight SCHMOCK turned on.
You want to turn on the right marker for the right trackable family car.
You want to turn off the sports car and turn off the truck sports car we're going to turn off the family
car and the truck and then pull the truck who'll turn off the family car and the sports car.
So they now got all separate options.
Now before we continue we will also need to change our bill settings so that we're doing an android
project.
Which platform or Iowas.
And if you're going to build it the attitude of us to test it don't forget to add your saying up in
here I'm not just going to build it in the editor.
OK so we've now got AMAC is we need to make a drawer or a bull from each of these prefab So in the package
you downloaded for vehicles.
There's three There's a sports car of the family car on the truck.
Funnily enough because it's how many markers we've made now they're going to be in your assets folder
and I believe they're in prefabs yet prefabs and then vehicles you'll find them all here.
So the family car has a set of tires that come with it.
Sports car also has tires and the truck has tires as well and that's because they're controlled separately.
In that particular toolset before we display these on the Mokka there's something you need to do with
the size because they are quite large so I click on each one of these and I think I can probably do
selecting them all come over to their scale and put it at zero point to zero point two and zero point
two on the transform for scale.
Let me just check that worked.
Yep.
So they've all got that now that would just make them a little bit smaller on the marker.
Now if you control select the car the sports car and the truck object actually if you just look at them
separately first let's go to the sports car.
The y value for the sports car is minus four point three so when it instantiates is going to be that
far below the actual marker which is not where you're going to Wantage the same thing.
We look at the family car.
It's also below zero on the Y.
The reason I'm pointing this out is that when these cars instantiate they've got physics on them and
they're going to fall to the ground.
If you look at each car in fact you can see the rigid body that's on there with the gravity you want
gravity because you do want them to react to sort of landing on something.
So what I'm going to do with age of those four just again command select just the body of the vehicles
and then the position let's sit them all to zero zero zero and we mousehole do the rotations while we're
there as well.
Just zero them all off so that we're not left with any sort of legacy information that comes with them.
Now they're all ready to go and test out first of all though we do need to remove that main camera so
we've got the we could shoot camera in charge.
But remember I just said that h has physics on it.
So when it instantiates it's going to start falling and it needs something to fall on to.
So and each of these We're going to add a 3-D object plane and let's do that to the sports car and also
to the truck OK so now let's try this out so press play and I'm going to just move my camera around
the up and they go.
Is a sports car on the market and you can see that that plane has still got its material on it just
the standard material doesn't have that transparent shader on there which we could go ahead and add.
And we might do that now.
So let's finish up with that.
So there's a material fold already in assets.
I'm going to drag and drop my transparent Shaila into there.
This is the same I've used before.
Then we need to create a material.
And that's our train's mat material which we will then set it to be a transparent shape to receive on
there then we can just select each plane and drag and drop it into an onto those objects.
KAYE press play and just set up my camera.
Yeah.
So there's the car.
Now let me move the car and we'll get in something else.
There's the truck.
The truck itself you could see there.
It's no good.
And momentum is going to roll off the marker in a minute but it has a little bit of a Juta when it first
hit.
That's probably a physics collision with the plane.
So that truck might even want to move it up just a little bit further.
So let's just stop flying.
Say what happens if we do do that.
So let's select those pre-fab vehicles we'll go to the car and again command select all control select
the family car sports car and the truck.
And let's just lifted up to let's say we'll put up to 1 in the Y for each of them.
OK let's see what happens.
Now we should see them come in and actually fall onto the market.
So you saw that.
And that's quite a nice little animated effect as they appear.
Let's show the truck.
And we'll also try the family.
So they're all working now.
Very good.
So you have to kind of imagine that that was a magazine where they're all sort of different pages and
you can turn the page and see the different effects.
Right now we're ready to add in the driving code for that.
Again to use the my belt stick as we've used before and we brought that in right at the beginning of
the project so in sort of standard assets we're going to the cross platform input and we're looking
for the ball single stick control the drag and drop that into the same.
Now it's going to give you your thumb stick controller and your jump button.
We will use the thumbs to control it to drive and turn the car and the jump button to brake.
So the other thing if you remember that we did last home we added this in is we need to add in the canvas
Skyla on to here so that we can then set these to scale with screen size to give us some kind of realistic
size for these icons that are on these controls.
Now with that in the saying it that any input get access has to be replaced with the crossplatform input
stuff.
Now if you have a look at these pre-fab cars that we brought in the track as the actual calls themselves
that go up to the prefabs and vehicles family car in the inspect you'll find that these vehicles are
already drivable.
So if you were to run the application now as it is you'll find that the Ericka's drive the car because
that's what this tool kit comes with for these particular vehicles and it's nice that it does that because
it means we can quickly replace any input.
Get access codes with the cross platform input so whatever asset you're getting to put on this object
if it's already got its own drive script you might be able to modify that or if it doesn't then you
would just remove the entire drive script and add your own like the one that we wrote previously.
OK so let's dig into this wheel drive code and open it up.
The first thing to make this usable as a cross-platform input to is to include that right at the very
top so adding unity stented assets dot cross platform import.
Now we need to look through the code and find where the controls currently being sit.
Usually you can define that in the update method or some we need they or way call from there I should
say for this one at the top of the update.
You're going to find that you've got the angle and the talk in NE and you also have your handbrake code.
So in this case you can use your case to move the car around but you can also break using the x key.
So we're going to just modify these three lines because they're the ones getting all of the input and
all we're really doing is just replacing anything that has these input here.
So this input becomes cross platform input manager get access and so does the second one down.
Now the handbrakes a little bit different because it's a key code and you're not applying it dynamically.
Or I should say dynamically not you know sort of applying it continuously as you do with the error case.
It's either going to be on or off.
So we're just going to replace all of this code here with this.
And let me just bring that down to the next one so you can see it.
OK.
So we're going to change from the x K to a spice bar instead for a breaking.
Then we're going to use the cross platform manager get button jump just like we did with the daurna
So the jumping.
But this time it's going to be used for braking.
Now if either one of these things are pressed then the bright torque is going to be set to zero and
that will stop your car moving and that's all you've got to do to update the code wheel drive.
C-s is on every one of those vehicles.
Let's just say this and we will now go into unity press play and try it out.
So there's a sports car and should be able to turn the wheels and then break and break into in a different
direction.
You don't want to drive off the plane.
Remember that plane is your physics Kolata.
I've only got the default size plane.
And so it would eventually fall off the plane and you can see the shadows are working quite nicely the
force as well.
Case.
Or just stop that.
Now you'll find this works for all of those vehicles and that you can then drive them around.
And so that is basically how you have multiple Marcuse in the one scene and then you're allowed to like
switch between them.