Hey what's up.
Mark Price you're at does slopes dotcom.
And we're going to get our projects started.
So first things first is to have X code open on my other screen here so I'm going to go to file new
project and then I'm going to place this somewhere.
So we're going to do is we're going to select augmented reality.
OK.
Click next.
And we're going to call this ramp up and content technology.
You can choose.
This is interesting.
This is important you can use to simulate Sprite or metal on metal of course is very broad bare bones
don't pick metal unless you're planning on building kind of your own engine around it.
You can actually use Spryte kit with augmented reality as to so you can do 2D stuff as well.
But we're going to cover the harder and more useful or practical use case which is seen kit working
with 3D and all this other information can stay the same.
We're going to be doing ours in swift of course.
Click next.
All right.
Good to go.
So a couple things or at least one thing is I will be doing less builds of the app in this section mostly
because every time I build I have to stop the video.
Go walk outside do the test and record the video and then put it back here in the video editor so you
can see what I'm actually doing.
It's not the easiest process here so you'll see that as you go along too.
It's your environment is very important.
For instance if it's dark in a room it can detect the edges so you can't place things.
Also the size of the models 3D models and everything is super important because it's using a scale that
is actually in your real world environment.
So you know if I'm putting a 15 foot skate ramp in my room it's not going to work.
So I actually have to go outside and all those things are important now with augmented reality is no
more just building and running and watching it.
But we'll make some good progress.
OK.
So let's take a look at our project see what we have Abdel.
Of course we've got this art MCNESS that's for scene kit.
All right.
And if you never seen it you're going to learn it to two birds with one stone.
Plus 3D games would sink it.
Awesome.
So by default the project loads with a ship LCN OK.
We can click it here and it's a model a 3D model.
All right pretty cool.
And one thing that's really important to know about a cmd file or seen file is that it can hold one
or more objects.
OK so sometimes you can actually what you what I'm saying is you can use a scene file for one model
or you can build out a whole level in it.
And that's where Apple does actually have a scene file for every single model and then they actually
have other seen files like let's say a level that has multiple other scenes included in it.
I know it sounds confusing because you're thinking maybe a scene is like a level or an environment but
no scene can be anything.
And that's what Apple's doing.
And their example projects here and we will do something similar here.
So you can play around this pretty cool if you've never worked with it before.
And then it has a texture here and we're not going to use these will get rid of them soon enough.
And we've got this view controller here.
All right pay attention to what's going on.
Very important stuff.
So we've got a scene view.
OK.
A scene view a RCN view.
OK this is our augmented reality view and this one has to do with 3-D.
So this is scene kit plus augmented reality scene kit plus a arcade notices right here.
It would be different.
In fact I think I have the docks over here.
If it was a sprite kit it would be a r s KVOA so for a sprite kit an augmented reality but we're using
sync.
So that's right ear.
And then you need to implement the scene view or the ARCC view delegate.
OK.
That's how you can register for augmented reality or A-R kit notifications and callback functions.
The the protocol functions OK.
And so that's implemented here and if you go to the storyboard All right you'll notice that you have
a view controller with a scene view on it OK and it's actually using the scene view as the base view
and we'll change that in just a little bit here.
And go ahead and plug your phone in.
OK plug your phone in and run the project.
And once it runs what you should see on your phone is a ship on your screen.
OK.
And that's the basic project care.
And so let's go back to the view controller that swift and first things first let's do some cleanup
here.
What I'm going to do is I'm going to rename this refactor rename and we're going to call this OK.
So my ex code keeps crashing and won't let me use the new refactor tool.
But the fact you are right click and go to refactor rename.
Obviously we're not doing that because it's not working.
So I can actually show you how to do it manually which is good and good to know anyway.
So class view controller what we're going to do is we're going to call this ramp plaister.
VC This is the this is the screen where you place the ramps.
OK.
So Medisave that here.
I'm going to change the file name to to ramp placer Visi and then the last thing we need to do is just
go into the storyboard here and on the speed controller here click the icon appeared the identity inspector
and instead of you controller it let's just call this ramp place.
You see.
So know we just did it manually.
No big deal.
So you have to do anyway before it's code side.
That new feature doesn't even work.
Goodness.
All right.
So a little more cleanup here newgroup and we're going to call this controller and let's put in the
placer boom like that.
That's looking good.
Ok cool.
So see this this view here it's kind of putting the base view and the reason why I don't want that here
is because I can't I can't do anything with it I can't put buttons on it I can't do anything.
And it's just it's not useful so what I'm actually going to do.
OK.
I'm going to delete this scene.
You.
Right.
And what am I going to do instead is I'm going to grab a regular you I view and put it on here.
Now we have a view which is good.
That's right click the ramp place and make sure abuse connected which it is.
So it did that for us automatically and noticed that we still have an outlet for the scene view.
So we do need to add that back here.
So what I'm going to type in here is A-R kit scene kit view and we will make it full screen like so
and we'll go ahead and pin on all four corners here.
No big deal.
We're just we're just making things a little bit better.
And then I'm going to right click rent place for ABC and the scene view I'm just going to drag it from
here over to here to connect that outlet there.
Cool.
So that's looking good there.
So now that we have a rent place here let's talk about a few things that are in here we've refactored
it a little bit of clean up.
We move some these around.
And so involuted load scene view.
DELEGATE.
OK so we're just setting the delegate which is here.
So these callback functions are these protocol functions will be call us show to show statistics is
just going to show timing and frames per second on your screen.
It's not first person shooter.
OK frames per second.
And then what you actually do is you create a scene kit scene OK.
And then you load it into the scene view because what needs to happen is your scene view it needs to
have some type of 3D scene to render onto the screen.
And in this case it's just a ship so even if it didn't have the scene you would see the camera but there'd
be no 3-D environment in there so this scene is grabbing something from the art or the sea and assets
in this case.
It's a ship that scene if you had a whole like world with like roads and trees and stuff and you use
that it would actually load that into your into your 3-D view.
So we're just basically loading a scene.
And what I like to do we're not here yet what I do is actually create an empty scene that is going to
hold all of your objects.
OK.
Versus just loading one scene like they did right here.
It's harder to work with this way.
They've got it random ship that's just we want to kind of an empty world that we can play with like
a playground but things.
OK so we're setting the scene.
And then here OK interview will appear anytime the view floats.
Well let's actually look at this from first and in time the view disappears.
We actually pause the market session.
OK.
And then when it reappears then we go ahead and we run that configuration session.
And so let's go to our documentation here and see what this means.
Our world tracking session configuration the air world tracking session configuration class provides
high precision motion tracking and enables features to help you place virtual conta in relation to real
world surfaces and situations where world tracking is not available.
The base class A-R session configuration provides simple motion tracking that permits less immersive
experiences to start an eight hour session create a session configuration object with the options you
want and then call the run method on the session object on your view or your seeing kit or your sprite
kit.
Mark why are you reading stuff to us.
I came here to learn not to read well this is where I learned it from the documentation you need to
be reading the stuff they're going to explain that way better than I am so.
Really important stuff right you have to have a tracking session configuration and it also mentioned
to us if things aren't working so right it's not a great environment for the proper market tracking
it will default to a more simple A-R a tracking setup so you've got to run your configuration OK like
so.
And any time you pause you have to rerun it here.
All right so that's it.
I mean that's it for as far as what the sample project gives you here and there.
Here are the callback or protocol functions.
It can fail with an error if the session was interrupted for some reason that maybe maybe a phone call
comes in you can handle that gracefully and at the end of the section and end this project all should
be walking through Apple's very immersive R.K. example project so you can see all the things that you
can do and then you'll see how these things are more so implemented here so really good stuff.
We're going to call this video done it was just an overview we did some cleanup here.
Getting your mind ready to actually start building some 3D 3D stuff in our air world so that's it for
now.
Marc price at soap's dot com let's move on.