1
00:00:05,700 --> 00:00:06,530
Hey what's up.

2
00:00:06,560 --> 00:00:08,960
Mark Price you're at does slopes dotcom.

3
00:00:08,990 --> 00:00:11,450
And we're going to get our projects started.

4
00:00:11,450 --> 00:00:17,390
So first things first is to have X code open on my other screen here so I'm going to go to file new

5
00:00:18,700 --> 00:00:23,150
project and then I'm going to place this somewhere.

6
00:00:23,250 --> 00:00:26,250
So we're going to do is we're going to select augmented reality.

7
00:00:26,870 --> 00:00:27,710
OK.

8
00:00:28,010 --> 00:00:28,820
Click next.

9
00:00:29,180 --> 00:00:35,120
And we're going to call this ramp up and content technology.

10
00:00:35,120 --> 00:00:36,000
You can choose.

11
00:00:36,170 --> 00:00:36,950
This is interesting.

12
00:00:37,040 --> 00:00:43,820
This is important you can use to simulate Sprite or metal on metal of course is very broad bare bones

13
00:00:43,940 --> 00:00:47,330
don't pick metal unless you're planning on building kind of your own engine around it.

14
00:00:47,330 --> 00:00:53,990
You can actually use Spryte kit with augmented reality as to so you can do 2D stuff as well.

15
00:00:54,170 --> 00:00:59,510
But we're going to cover the harder and more useful or practical use case which is seen kit working

16
00:00:59,510 --> 00:01:02,630
with 3D and all this other information can stay the same.

17
00:01:02,630 --> 00:01:04,780
We're going to be doing ours in swift of course.

18
00:01:04,800 --> 00:01:06,640
Click next.

19
00:01:06,640 --> 00:01:07,160
All right.

20
00:01:07,980 --> 00:01:08,650
Good to go.

21
00:01:08,730 --> 00:01:16,650
So a couple things or at least one thing is I will be doing less builds of the app in this section mostly

22
00:01:16,650 --> 00:01:19,770
because every time I build I have to stop the video.

23
00:01:19,770 --> 00:01:27,000
Go walk outside do the test and record the video and then put it back here in the video editor so you

24
00:01:27,000 --> 00:01:28,430
can see what I'm actually doing.

25
00:01:28,740 --> 00:01:33,900
It's not the easiest process here so you'll see that as you go along too.

26
00:01:34,530 --> 00:01:37,050
It's your environment is very important.

27
00:01:37,050 --> 00:01:40,770
For instance if it's dark in a room it can detect the edges so you can't place things.

28
00:01:40,770 --> 00:01:46,620
Also the size of the models 3D models and everything is super important because it's using a scale that

29
00:01:46,620 --> 00:01:48,280
is actually in your real world environment.

30
00:01:48,280 --> 00:01:52,350
So you know if I'm putting a 15 foot skate ramp in my room it's not going to work.

31
00:01:52,350 --> 00:01:55,600
So I actually have to go outside and all those things are important now with augmented reality is no

32
00:01:55,600 --> 00:01:58,240
more just building and running and watching it.

33
00:01:58,710 --> 00:02:00,200
But we'll make some good progress.

34
00:02:00,500 --> 00:02:00,720
OK.

35
00:02:00,720 --> 00:02:03,430
So let's take a look at our project see what we have Abdel.

36
00:02:03,540 --> 00:02:08,570
Of course we've got this art MCNESS that's for scene kit.

37
00:02:08,580 --> 00:02:09,230
All right.

38
00:02:09,270 --> 00:02:14,240
And if you never seen it you're going to learn it to two birds with one stone.

39
00:02:14,460 --> 00:02:16,530
Plus 3D games would sink it.

40
00:02:16,560 --> 00:02:17,690
Awesome.

41
00:02:17,700 --> 00:02:22,240
So by default the project loads with a ship LCN OK.

42
00:02:22,290 --> 00:02:26,730
We can click it here and it's a model a 3D model.

43
00:02:26,730 --> 00:02:27,830
All right pretty cool.

44
00:02:27,840 --> 00:02:37,160
And one thing that's really important to know about a cmd file or seen file is that it can hold one

45
00:02:37,160 --> 00:02:38,290
or more objects.

46
00:02:38,300 --> 00:02:44,300
OK so sometimes you can actually what you what I'm saying is you can use a scene file for one model

47
00:02:44,360 --> 00:02:46,520
or you can build out a whole level in it.

48
00:02:46,820 --> 00:02:52,580
And that's where Apple does actually have a scene file for every single model and then they actually

49
00:02:53,690 --> 00:02:59,660
have other seen files like let's say a level that has multiple other scenes included in it.

50
00:02:59,660 --> 00:03:03,800
I know it sounds confusing because you're thinking maybe a scene is like a level or an environment but

51
00:03:04,340 --> 00:03:06,330
no scene can be anything.

52
00:03:06,590 --> 00:03:07,780
And that's what Apple's doing.

53
00:03:08,300 --> 00:03:12,000
And their example projects here and we will do something similar here.

54
00:03:12,140 --> 00:03:15,660
So you can play around this pretty cool if you've never worked with it before.

55
00:03:15,740 --> 00:03:20,180
And then it has a texture here and we're not going to use these will get rid of them soon enough.

56
00:03:20,210 --> 00:03:22,400
And we've got this view controller here.

57
00:03:22,880 --> 00:03:24,920
All right pay attention to what's going on.

58
00:03:24,920 --> 00:03:26,200
Very important stuff.

59
00:03:26,540 --> 00:03:29,550
So we've got a scene view.

60
00:03:29,740 --> 00:03:30,240
OK.

61
00:03:30,290 --> 00:03:32,410
A scene view a RCN view.

62
00:03:32,410 --> 00:03:38,000
OK this is our augmented reality view and this one has to do with 3-D.

63
00:03:38,000 --> 00:03:42,830
So this is scene kit plus augmented reality scene kit plus a arcade notices right here.

64
00:03:43,190 --> 00:03:44,220
It would be different.

65
00:03:44,240 --> 00:03:48,260
In fact I think I have the docks over here.

66
00:03:48,260 --> 00:03:53,780
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

67
00:03:53,780 --> 00:03:54,170
sync.

68
00:03:54,200 --> 00:03:55,290
So that's right ear.

69
00:03:55,670 --> 00:04:00,710
And then you need to implement the scene view or the ARCC view delegate.

70
00:04:00,870 --> 00:04:01,330
OK.

71
00:04:01,430 --> 00:04:08,320
That's how you can register for augmented reality or A-R kit notifications and callback functions.

72
00:04:08,370 --> 00:04:11,320
The the protocol functions OK.

73
00:04:11,390 --> 00:04:17,170
And so that's implemented here and if you go to the storyboard All right you'll notice that you have

74
00:04:17,170 --> 00:04:22,090
a view controller with a scene view on it OK and it's actually using the scene view as the base view

75
00:04:22,590 --> 00:04:25,350
and we'll change that in just a little bit here.

76
00:04:25,720 --> 00:04:28,830
And go ahead and plug your phone in.

77
00:04:29,140 --> 00:04:32,100
OK plug your phone in and run the project.

78
00:04:32,440 --> 00:04:38,570
And once it runs what you should see on your phone is a ship on your screen.

79
00:04:38,710 --> 00:04:39,330
OK.

80
00:04:39,610 --> 00:04:41,780
And that's the basic project care.

81
00:04:41,780 --> 00:04:45,570
And so let's go back to the view controller that swift and first things first let's do some cleanup

82
00:04:45,580 --> 00:04:46,840
here.

83
00:04:46,870 --> 00:04:55,760
What I'm going to do is I'm going to rename this refactor rename and we're going to call this OK.

84
00:04:55,780 --> 00:04:59,790
So my ex code keeps crashing and won't let me use the new refactor tool.

85
00:04:59,980 --> 00:05:03,220
But the fact you are right click and go to refactor rename.

86
00:05:03,220 --> 00:05:05,110
Obviously we're not doing that because it's not working.

87
00:05:05,260 --> 00:05:08,770
So I can actually show you how to do it manually which is good and good to know anyway.

88
00:05:08,770 --> 00:05:13,960
So class view controller what we're going to do is we're going to call this ramp plaister.

89
00:05:13,990 --> 00:05:17,340
VC This is the this is the screen where you place the ramps.

90
00:05:17,350 --> 00:05:17,810
OK.

91
00:05:17,950 --> 00:05:19,260
So Medisave that here.

92
00:05:19,330 --> 00:05:26,490
I'm going to change the file name to to ramp placer Visi and then the last thing we need to do is just

93
00:05:26,500 --> 00:05:33,860
go into the storyboard here and on the speed controller here click the icon appeared the identity inspector

94
00:05:33,970 --> 00:05:36,600
and instead of you controller it let's just call this ramp place.

95
00:05:37,050 --> 00:05:37,710
You see.

96
00:05:37,750 --> 00:05:39,540
So know we just did it manually.

97
00:05:39,550 --> 00:05:40,580
No big deal.

98
00:05:40,810 --> 00:05:43,820
So you have to do anyway before it's code side.

99
00:05:43,840 --> 00:05:45,310
That new feature doesn't even work.

100
00:05:45,310 --> 00:05:46,070
Goodness.

101
00:05:46,300 --> 00:05:46,540
All right.

102
00:05:46,550 --> 00:05:55,540
So a little more cleanup here newgroup and we're going to call this controller and let's put in the

103
00:05:56,530 --> 00:05:59,950
placer boom like that.

104
00:05:59,950 --> 00:06:00,910
That's looking good.

105
00:06:01,130 --> 00:06:03,350
Ok cool.

106
00:06:03,370 --> 00:06:10,590
So see this this view here it's kind of putting the base view and the reason why I don't want that here

107
00:06:10,950 --> 00:06:15,810
is because I can't I can't do anything with it I can't put buttons on it I can't do anything.

108
00:06:16,110 --> 00:06:19,940
And it's just it's not useful so what I'm actually going to do.

109
00:06:20,160 --> 00:06:20,480
OK.

110
00:06:20,490 --> 00:06:21,800
I'm going to delete this scene.

111
00:06:21,810 --> 00:06:22,940
You.

112
00:06:22,990 --> 00:06:23,570
Right.

113
00:06:23,610 --> 00:06:33,320
And what am I going to do instead is I'm going to grab a regular you I view and put it on here.

114
00:06:36,960 --> 00:06:38,610
Now we have a view which is good.

115
00:06:38,640 --> 00:06:41,790
That's right click the ramp place and make sure abuse connected which it is.

116
00:06:41,790 --> 00:06:45,900
So it did that for us automatically and noticed that we still have an outlet for the scene view.

117
00:06:45,900 --> 00:06:48,030
So we do need to add that back here.

118
00:06:48,030 --> 00:06:58,150
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

119
00:06:59,750 --> 00:07:02,910
and we'll go ahead and pin on all four corners here.

120
00:07:02,930 --> 00:07:03,720
No big deal.

121
00:07:03,770 --> 00:07:06,730
We're just we're just making things a little bit better.

122
00:07:07,040 --> 00:07:11,240
And then I'm going to right click rent place for ABC and the scene view I'm just going to drag it from

123
00:07:11,240 --> 00:07:14,220
here over to here to connect that outlet there.

124
00:07:15,120 --> 00:07:16,430
Cool.

125
00:07:16,510 --> 00:07:17,620
So that's looking good there.

126
00:07:17,730 --> 00:07:22,860
So now that we have a rent place here let's talk about a few things that are in here we've refactored

127
00:07:22,860 --> 00:07:24,120
it a little bit of clean up.

128
00:07:24,120 --> 00:07:26,080
We move some these around.

129
00:07:26,340 --> 00:07:28,980
And so involuted load scene view.

130
00:07:29,040 --> 00:07:29,490
DELEGATE.

131
00:07:29,520 --> 00:07:33,490
OK so we're just setting the delegate which is here.

132
00:07:33,500 --> 00:07:38,450
So these callback functions are these protocol functions will be call us show to show statistics is

133
00:07:38,450 --> 00:07:43,420
just going to show timing and frames per second on your screen.

134
00:07:43,430 --> 00:07:45,250
It's not first person shooter.

135
00:07:45,410 --> 00:07:46,910
OK frames per second.

136
00:07:47,270 --> 00:07:53,070
And then what you actually do is you create a scene kit scene OK.

137
00:07:53,270 --> 00:07:58,070
And then you load it into the scene view because what needs to happen is your scene view it needs to

138
00:07:58,070 --> 00:08:02,180
have some type of 3D scene to render onto the screen.

139
00:08:02,210 --> 00:08:06,770
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

140
00:08:06,770 --> 00:08:13,580
be no 3-D environment in there so this scene is grabbing something from the art or the sea and assets

141
00:08:13,590 --> 00:08:14,120
in this case.

142
00:08:14,150 --> 00:08:20,060
It's a ship that scene if you had a whole like world with like roads and trees and stuff and you use

143
00:08:20,060 --> 00:08:23,360
that it would actually load that into your into your 3-D view.

144
00:08:23,360 --> 00:08:26,050
So we're just basically loading a scene.

145
00:08:26,390 --> 00:08:32,750
And what I like to do we're not here yet what I do is actually create an empty scene that is going to

146
00:08:32,750 --> 00:08:34,120
hold all of your objects.

147
00:08:34,190 --> 00:08:35,220
OK.

148
00:08:35,240 --> 00:08:38,820
Versus just loading one scene like they did right here.

149
00:08:38,820 --> 00:08:40,520
It's harder to work with this way.

150
00:08:40,520 --> 00:08:45,170
They've got it random ship that's just we want to kind of an empty world that we can play with like

151
00:08:45,170 --> 00:08:46,400
a playground but things.

152
00:08:46,770 --> 00:08:48,710
OK so we're setting the scene.

153
00:08:48,710 --> 00:08:53,630
And then here OK interview will appear anytime the view floats.

154
00:08:53,690 --> 00:08:56,020
Well let's actually look at this from first and in time the view disappears.

155
00:08:56,030 --> 00:08:58,420
We actually pause the market session.

156
00:08:58,420 --> 00:08:58,780
OK.

157
00:08:58,790 --> 00:09:03,680
And then when it reappears then we go ahead and we run that configuration session.

158
00:09:03,680 --> 00:09:07,570
And so let's go to our documentation here and see what this means.

159
00:09:07,610 --> 00:09:13,490
Our world tracking session configuration the air world tracking session configuration class provides

160
00:09:13,490 --> 00:09:18,710
high precision motion tracking and enables features to help you place virtual conta in relation to real

161
00:09:18,710 --> 00:09:22,870
world surfaces and situations where world tracking is not available.

162
00:09:22,870 --> 00:09:28,160
The base class A-R session configuration provides simple motion tracking that permits less immersive

163
00:09:28,430 --> 00:09:33,530
experiences to start an eight hour session create a session configuration object with the options you

164
00:09:33,530 --> 00:09:40,520
want and then call the run method on the session object on your view or your seeing kit or your sprite

165
00:09:40,520 --> 00:09:41,080
kit.

166
00:09:41,570 --> 00:09:43,310
Mark why are you reading stuff to us.

167
00:09:43,310 --> 00:09:48,320
I came here to learn not to read well this is where I learned it from the documentation you need to

168
00:09:48,320 --> 00:09:51,380
be reading the stuff they're going to explain that way better than I am so.

169
00:09:51,800 --> 00:09:55,970
Really important stuff right you have to have a tracking session configuration and it also mentioned

170
00:09:55,970 --> 00:10:01,490
to us if things aren't working so right it's not a great environment for the proper market tracking

171
00:10:01,490 --> 00:10:09,440
it will default to a more simple A-R a tracking setup so you've got to run your configuration OK like

172
00:10:09,440 --> 00:10:10,290
so.

173
00:10:10,630 --> 00:10:12,680
And any time you pause you have to rerun it here.

174
00:10:12,800 --> 00:10:15,110
All right so that's it.

175
00:10:15,110 --> 00:10:19,010
I mean that's it for as far as what the sample project gives you here and there.

176
00:10:19,010 --> 00:10:21,520
Here are the callback or protocol functions.

177
00:10:21,770 --> 00:10:26,480
It can fail with an error if the session was interrupted for some reason that maybe maybe a phone call

178
00:10:26,480 --> 00:10:32,450
comes in you can handle that gracefully and at the end of the section and end this project all should

179
00:10:32,450 --> 00:10:38,060
be walking through Apple's very immersive R.K. example project so you can see all the things that you

180
00:10:38,060 --> 00:10:44,010
can do and then you'll see how these things are more so implemented here so really good stuff.

181
00:10:44,030 --> 00:10:47,880
We're going to call this video done it was just an overview we did some cleanup here.

182
00:10:47,960 --> 00:10:54,170
Getting your mind ready to actually start building some 3D 3D stuff in our air world so that's it for

183
00:10:54,170 --> 00:10:54,320
now.

184
00:10:54,320 --> 00:10:57,540
Marc price at soap's dot com let's move on.
