1
00:00:05,730 --> 00:00:11,850
A what's up everyone Mark Price your slopes column and we're making great progress with our arcade app.

2
00:00:12,390 --> 00:00:22,100
And what we've done so far is we've made it so you can see three objects three 3-D objects in a View

3
00:00:22,100 --> 00:00:24,550
Controller in a scene view the rotating.

4
00:00:24,590 --> 00:00:28,880
And when you tap it it prints the name so we know which one is being tapped and we're actually passing

5
00:00:28,880 --> 00:00:31,750
that name back to a remote place or ABC.

6
00:00:32,000 --> 00:00:39,020
And what we want to do here in the on ramp selected OK is what we want to do is we want to make it so

7
00:00:43,520 --> 00:00:47,220
it stores the name of the object that we're going to be placing.

8
00:00:47,450 --> 00:00:47,990
OK.

9
00:00:48,140 --> 00:00:53,060
And then when we need to detect when the screen is tapped again so we can actually place it in the appropriate

10
00:00:53,060 --> 00:00:53,460
spot.

11
00:00:53,470 --> 00:00:54,940
But on this screen this time.

12
00:00:55,010 --> 00:01:02,300
So we're going to need a variable to store the name of the ramp so let's go up to the top here and create

13
00:01:02,300 --> 00:01:09,850
a new variable here var and we're going to say selected ramp is going to be of type string and it isn't

14
00:01:09,860 --> 00:01:14,510
optional because it may at first there's nothing there.

15
00:01:14,690 --> 00:01:16,250
So var selected ramp.

16
00:01:16,910 --> 00:01:23,580
And what we're going to do is say selected ramp ramp name.

17
00:01:24,000 --> 00:01:25,200
It looks good to me.

18
00:01:25,400 --> 00:01:32,000
And then we just probably need to implement the touches began to override function here.

19
00:01:32,300 --> 00:01:39,810
So let's put that let's put it here just for fun or to say touches began.

20
00:01:39,950 --> 00:01:43,840
And anytime a touch starts it'll call this code here which is what we want.

21
00:01:44,120 --> 00:01:49,730
And then let's just write some code to detect the touch get it's the position of the touch and then

22
00:01:49,730 --> 00:01:52,940
we need to place a 3D object at the point that's being touched.

23
00:01:52,950 --> 00:01:56,760
OK so it detects a touch figures out where on the screen it's happening.

24
00:01:56,960 --> 00:02:06,350
And then we can place an object there and when detecting a touch on the on the view here this A-R scene

25
00:02:06,420 --> 00:02:11,060
view you do it a little bit differently than we just did it in the regular scene.

26
00:02:11,070 --> 00:02:14,060
So let's go ahead and get started here.

27
00:02:14,070 --> 00:02:18,480
So guard let touch equals touch up first.

28
00:02:18,660 --> 00:02:24,730
So we're guarding against there not being touch or.

29
00:02:26,270 --> 00:02:26,530
Yeah.

30
00:02:26,550 --> 00:02:30,610
We're guarding against they're not being attacked so we're grabbing touches down first.

31
00:02:30,630 --> 00:02:31,140
OK.

32
00:02:32,880 --> 00:02:37,790
And then the next thing is let results equals scene view.

33
00:02:37,860 --> 00:02:44,070
Hit tests we are using the similar test because it is using the same functionality under the hood that

34
00:02:44,070 --> 00:02:44,790
we just did.

35
00:02:44,940 --> 00:02:46,310
So hit test.

36
00:02:46,410 --> 00:02:50,890
And in this case we're going to type touch dot location for the point.

37
00:02:51,630 --> 00:02:57,380
OK you touch that location.

38
00:02:57,650 --> 00:02:58,230
OK.

39
00:02:59,030 --> 00:03:01,470
Seen you.

40
00:03:01,680 --> 00:03:02,210
There you go.

41
00:03:02,230 --> 00:03:06,770
OK we're calling the touch that location function seem you got confused by the syntax here.

42
00:03:06,800 --> 00:03:14,460
And then lastly we have the options and what we want in this case is a feature point.

43
00:03:14,570 --> 00:03:15,540
OK.

44
00:03:17,050 --> 00:03:19,710
We'll let this stop airing out on us.

45
00:03:19,720 --> 00:03:23,990
Come on now what did I spelled wrong.

46
00:03:25,220 --> 00:03:26,000
Feature point.

47
00:03:26,000 --> 00:03:31,340
This looks good to me.

48
00:03:31,960 --> 00:03:32,770
Closing closing.

49
00:03:32,770 --> 00:03:33,520
That's correct.

50
00:03:33,520 --> 00:03:34,790
What does it yelling at me for.

51
00:03:37,790 --> 00:03:41,150
Does not like it at all what is going on.

52
00:03:41,150 --> 00:03:44,510
Feature point feature point types.

53
00:03:44,510 --> 00:03:47,000
Oh I called the wrong I called the wrong

54
00:03:51,060 --> 00:03:54,340
the wrong thing types.

55
00:03:54,510 --> 00:03:55,140
OK.

56
00:03:55,200 --> 00:03:59,010
And what I wanted to do was show you the feature point here.

57
00:03:59,820 --> 00:04:00,310
OK.

58
00:04:00,550 --> 00:04:05,010
So result type result type from intersecting the near future point.

59
00:04:05,010 --> 00:04:06,380
This is in our kit.

60
00:04:06,490 --> 00:04:10,740
And so basically remember it detects the floors in the walls and everything.

61
00:04:10,750 --> 00:04:16,450
And so when you tap it's using it's very complex under the hood math to figure out where on the wall

62
00:04:16,450 --> 00:04:18,730
or the floor that you tap and get the actual distance to stuff.

63
00:04:18,730 --> 00:04:20,200
Very cool stuff.

64
00:04:20,320 --> 00:04:23,650
Very complex stuff in there doing that for us and so that's what future point does.

65
00:04:23,650 --> 00:04:27,720
You can also look at some of the other things that they have here as well to see what they do.

66
00:04:27,730 --> 00:04:31,470
I will not be explaining them because we are using the feature point.

67
00:04:31,850 --> 00:04:36,550
It's just going to get the nearest intersection in your in your room or you're outside or wherever it's

68
00:04:36,550 --> 00:04:37,150
detecting.

69
00:04:37,150 --> 00:04:37,950
OK.

70
00:04:38,420 --> 00:04:40,000
Guard let hit.

71
00:04:40,000 --> 00:04:44,840
Feature equals results that last else return.

72
00:04:45,070 --> 00:04:47,680
So now we're getting the results of a tap.

73
00:04:47,680 --> 00:04:49,980
So here's something really important.

74
00:04:49,990 --> 00:04:56,650
Understand sometimes a market can't find angles if your rooms too dark it can't find an angle if it's

75
00:04:56,650 --> 00:04:58,150
too dark anywhere or too fuzzy.

76
00:04:58,150 --> 00:05:02,650
Or let's say you're just looking at the ground but it can't see walls or can't see a car in the distance

77
00:05:02,650 --> 00:05:05,200
or something that can give it some context.

78
00:05:05,440 --> 00:05:07,540
You may get nothing here and it will return.

79
00:05:07,540 --> 00:05:13,230
So if you're in our app and other apps let's say especially in our app if you're tapping and like nothing's

80
00:05:13,240 --> 00:05:15,450
happening it's because we're hitting this return same.

81
00:05:15,470 --> 00:05:19,180
And the reason why is because it's not finding the feature on the ground.

82
00:05:19,300 --> 00:05:23,050
But you'll notice when you move closer to something where there's two objects.

83
00:05:23,050 --> 00:05:24,190
It works.

84
00:05:24,190 --> 00:05:29,960
And so it needs it needs context in order to be able to place the object.

85
00:05:30,000 --> 00:05:33,730
OK hit feature results that last else return.

86
00:05:33,730 --> 00:05:38,820
So we got to make sure that we actually find an object when when it's being tapped.

87
00:05:38,830 --> 00:05:46,810
It finds that reference point OK let it transform equals as seen matrix for.

88
00:05:47,470 --> 00:05:48,100
OK.

89
00:05:48,370 --> 00:05:55,480
And what we're going to do is we're just going to pass in the the world transform the hit feature so

90
00:05:55,480 --> 00:05:58,850
hit feature that world transform.

91
00:05:59,270 --> 00:06:00,010
OK.

92
00:06:00,220 --> 00:06:02,840
So grabbing the transform from the from the tap.

93
00:06:02,900 --> 00:06:03,370
OK.

94
00:06:03,370 --> 00:06:07,780
Meaning remember if there was nothing we're returning we're not even getting here otherwise there was

95
00:06:07,780 --> 00:06:14,350
something and we are going to take it and get the transform for it so we can actually use it and place

96
00:06:14,350 --> 00:06:15,130
a 3-D object.

97
00:06:15,130 --> 00:06:15,810
OK.

98
00:06:16,300 --> 00:06:22,050
Let me hit position equals se and vector 3 make.

99
00:06:22,390 --> 00:06:23,980
We're going to say hit transform

100
00:06:26,590 --> 00:06:28,780
em for one hit.

101
00:06:28,780 --> 00:06:41,590
Transform em for two and get transformed for three and a fourth.

102
00:06:41,590 --> 00:06:42,220
Thank you.

103
00:06:43,680 --> 00:06:45,160
Let's make sure there's no errors here.

104
00:06:47,900 --> 00:06:48,370
OK.

105
00:06:48,540 --> 00:06:49,580
And you're probably wondering.

106
00:06:49,590 --> 00:06:53,670
Hey Mark how do you know what for one and for 2 and 4 3 is.

107
00:06:53,700 --> 00:07:00,270
Well if we can click this here OK we're going to be sadly disappointed because there's not a whole lot

108
00:07:00,270 --> 00:07:06,000
of information on what these are but what's happening is this C-n matrix for is storing data in regards

109
00:07:06,000 --> 00:07:10,410
to the transform from this from this hit test here.

110
00:07:10,410 --> 00:07:16,480
And because Apple documentation and Apple examples say so I know that M for one and for two and forth

111
00:07:16,520 --> 00:07:21,930
three are the translation or the positioning floats that you need to access.

112
00:07:22,020 --> 00:07:25,230
Outside of that I honestly am not sure how you would figure it out.

113
00:07:25,230 --> 00:07:30,270
There's no documentation on there but in the Apple documentation they do reference these three points

114
00:07:30,330 --> 00:07:32,840
as translation or position.

115
00:07:32,940 --> 00:07:38,580
And so that's what we're grabbing here of the hit position which is why you got to read Apple documentation.

116
00:07:38,580 --> 00:07:41,650
Usually it's very safe to do things the way that they do it.

117
00:07:41,650 --> 00:07:43,270
And their example projects.

118
00:07:43,440 --> 00:07:50,760
So what we've done here is we have we've looked at we've done a hit test so we grabbed the touch.

119
00:07:50,820 --> 00:07:53,960
We've done a hit test on that touch on to get the results.

120
00:07:53,960 --> 00:07:55,050
Now if there was a tap.

121
00:07:55,140 --> 00:07:59,820
OK what we're doing is we're grabbing the world transform of that touch.

122
00:07:59,940 --> 00:08:01,260
OK.

123
00:08:01,260 --> 00:08:08,850
So the hit feature is going to it's going to find the horizontal and vertical position of where you

124
00:08:08,850 --> 00:08:09,390
tapped.

125
00:08:09,390 --> 00:08:12,890
And again you know make sure you tap on something that has context.

126
00:08:13,050 --> 00:08:14,910
We're grabbing the word transform for that.

127
00:08:15,000 --> 00:08:19,880
And then we're creating a positioning vector 3 here of the actual position and 3D accordant space so

128
00:08:19,880 --> 00:08:21,180
we can place an object.

129
00:08:21,380 --> 00:08:23,850
And you don't have to understand this completely in order to use it.

130
00:08:23,940 --> 00:08:30,030
But this is typically the process you'll follow when placing objects in a market in a 3-D space very

131
00:08:30,030 --> 00:08:31,410
similar to this here.

132
00:08:31,680 --> 00:08:36,010
OK the next step is to actually place an object on the screen.

133
00:08:36,060 --> 00:08:36,960
So how do we do that.

134
00:08:36,960 --> 00:08:41,190
Well we're going to have to create the node like we did in the in the picker with the three objects

135
00:08:41,220 --> 00:08:43,530
and then place it at the position.

136
00:08:43,560 --> 00:08:48,490
So down here we can create a function called Place ramp.

137
00:08:48,670 --> 00:08:53,780
We're going to pass in the position of S in vector 3 like so.

138
00:08:54,390 --> 00:08:56,240
And then let's call this function up here.

139
00:08:56,280 --> 00:08:58,650
So we're going to say placed ramp.

140
00:08:58,650 --> 00:09:04,270
And let's just pass in the hit position like so.

141
00:09:04,510 --> 00:09:08,200
And then what do we need to do here we need to actually get those ramps again.

142
00:09:08,330 --> 00:09:12,530
So see here yeah we've got timeless do it.

143
00:09:12,540 --> 00:09:18,250
So over here in our ramp picker OK we've got these We've got these three objects here as you can see

144
00:09:18,490 --> 00:09:24,700
these three 3-D objects and we need to be able to have similar code so what I want to do is I want to

145
00:09:24,880 --> 00:09:27,840
refactor to make this more more reusable.

146
00:09:27,950 --> 00:09:34,640
OK so we're going to go to our project here and new group and we're going to call this model.

147
00:09:35,440 --> 00:09:39,140
And inside the model folder we're going to add a new file.

148
00:09:39,550 --> 00:09:40,240
OK.

149
00:09:40,570 --> 00:09:44,690
And what we want to do is just make this a swift file and make empty right now.

150
00:09:44,860 --> 00:09:51,540
And let's call this ramp and we're going to import scene kit.

151
00:09:51,550 --> 00:09:53,600
So class is going to be ramp.

152
00:09:54,070 --> 00:09:59,710
And then what we're going to do is create a series of functions static functions that we can just call

153
00:09:59,710 --> 00:10:01,500
to get the things that we want to get.

154
00:10:01,660 --> 00:10:11,080
So what we can do is we can say class phunk get pipe for getting the halfpipe and it's going to return

155
00:10:11,410 --> 00:10:14,420
in N.S.A. like so.

156
00:10:14,420 --> 00:10:20,300
And then what we can do is we can go to a ramp picker code and we can copy some of the stuff here.

157
00:10:20,300 --> 00:10:27,570
So it's going to take this copy the pipe go back to our ramp pace to here will change changes to let's

158
00:10:27,650 --> 00:10:30,760
do this time and left.

159
00:10:31,140 --> 00:10:40,610
But instead of adding to the root note we'll just returned the note itself like so very good.

160
00:10:40,820 --> 00:10:50,840
And then we'll create one for will create two others for class phunk get pyramid C.A. and then world

161
00:10:51,170 --> 00:10:57,160
class phunk get quarter for the quarter as seen.

162
00:10:57,310 --> 00:10:58,220
No.

163
00:10:59,110 --> 00:11:00,090
Like so.

164
00:11:00,350 --> 00:11:05,440
And let me point out here where we're specifically grabbing objects.

165
00:11:05,440 --> 00:11:05,850
OK.

166
00:11:05,870 --> 00:11:09,610
And placing them with a certain scale and things because we want them to look a certain way.

167
00:11:09,800 --> 00:11:14,840
If you're actually building a game or there's lots of things going on objects being instantiated coming

168
00:11:14,840 --> 00:11:20,330
from different places of course you wouldn't manually like place individual objects here because you

169
00:11:20,330 --> 00:11:23,910
would be able to manage it all by I say scene kids.

170
00:11:24,030 --> 00:11:25,180
I think it's pretty rough to work with.

171
00:11:25,170 --> 00:11:26,580
I would not make a game and sink it.

172
00:11:26,600 --> 00:11:31,250
If you want to make full scale game do it and unity 3D absolutely for sure.

173
00:11:31,490 --> 00:11:34,920
And we do have courses on an amazing course actually.

174
00:11:35,420 --> 00:11:36,740
And it's so easy to use.

175
00:11:36,740 --> 00:11:40,520
And so if you really are serious about working with a market and making something immersive where you

176
00:11:40,520 --> 00:11:45,020
don't need the standard controls from Iowa has worked with unity.

177
00:11:45,020 --> 00:11:46,580
It's absolutely fantastic.

178
00:11:46,580 --> 00:11:47,180
OK.

179
00:11:47,450 --> 00:11:52,670
And so node run action rotate we're going to take this out because we don't want the we don't want to

180
00:11:52,670 --> 00:11:58,780
run the rotation on the on the objects that are in the in the market.

181
00:11:58,820 --> 00:12:00,370
So when you take that out there.

182
00:12:00,500 --> 00:12:09,610
And so there's our get pipe Let's go back to our picker and let's go ahead and copy this one so ramp

183
00:12:10,690 --> 00:12:11,510
ramp.

184
00:12:11,530 --> 00:12:12,960
So this is the pyramid right.

185
00:12:13,040 --> 00:12:14,960
Yep this is great.

186
00:12:15,400 --> 00:12:19,560
Let here and the law here we're just we're refactoring making a little more better.

187
00:12:19,570 --> 00:12:24,200
It's not a huge improvement but it's a little improvement and that's good enough for me.

188
00:12:24,310 --> 00:12:29,200
Return node like so.

189
00:12:29,570 --> 00:12:39,880
And let's go over here again to our quarter pipe and do the same thing.

190
00:12:39,940 --> 00:12:49,210
Good quarter and we're going to say let and let us get rid of the action and let's get rid of the root

191
00:12:49,210 --> 00:12:55,040
node thingy and let's return the node like so.

192
00:12:55,300 --> 00:13:01,360
And then what we can do is go back to our ramp picker and we can refactor this here which is nice and

193
00:13:01,360 --> 00:13:06,760
you know what let's actually let's put this in a function as well to this this rotate action.

194
00:13:06,940 --> 00:13:10,170
Let's put it in there so let's go back to our ramp actually.

195
00:13:10,170 --> 00:13:17,280
And it's great another class function class phunk start to make this bigger for you here.

196
00:13:19,280 --> 00:13:25,870
We start rotation pass in a node and we're just going to rotate it as C.A..

197
00:13:26,630 --> 00:13:35,410
All we have to do is take those lines of code from the ramp picker namely the rotation like so place

198
00:13:35,410 --> 00:13:44,370
it here and then let's grab the run action like so and place it in the ramp as well.

199
00:13:44,920 --> 00:13:46,260
So did I just do.

200
00:13:47,630 --> 00:13:50,060
I did something silly didn't I.

201
00:13:50,620 --> 00:13:52,280
This is my go here it goes.

202
00:13:52,840 --> 00:13:54,210
And the ramp.

203
00:13:54,310 --> 00:13:55,330
There we go.

204
00:13:55,780 --> 00:13:57,520
And then back to the ramp.

205
00:13:57,520 --> 00:13:58,700
The ramp picker.

206
00:13:58,780 --> 00:14:04,740
We will do the no dot run action command see and Pat put it over here and our ramp.

207
00:14:04,930 --> 00:14:10,330
OK so we're just taking this note that was passed in and we're just running an action on it.

208
00:14:10,540 --> 00:14:18,610
So now what we can do now that this is all cleaned up we can make our code it's a cleanable be here

209
00:14:18,610 --> 00:14:20,940
and now we can make our code more clean up in the rent picker.

210
00:14:21,070 --> 00:14:25,520
So what I want to do is I want to let's just delete all this stuff here.

211
00:14:28,010 --> 00:14:28,750
OK.

212
00:14:29,030 --> 00:14:37,290
And this too it should be pretty easy to say lead pipe equals ramp that get pipe and then we're going

213
00:14:37,290 --> 00:14:42,900
to say ramp it up start rotation and we'll pass in the pipe to start rotating it and then we'll say

214
00:14:43,020 --> 00:14:47,840
seen that root node ADD child and we're just going to say pipe.

215
00:14:48,180 --> 00:14:57,300
No big deal like so we'll do the same thing for the other one so let Pairin pyramid equals ramp Dogget

216
00:14:57,720 --> 00:15:01,640
pyramid ramp start rotation.

217
00:15:01,680 --> 00:15:09,840
Now we're going to say pyramid and then seen that root node add child node and we're going to say pyramid

218
00:15:10,260 --> 00:15:20,970
pyramid and WILLMORE let a quarter pipe or quarter equals ramp get quarter and we're to say ramp dot

219
00:15:21,090 --> 00:15:27,150
start rotation quarter and then we're going to say seen up root node.

220
00:15:27,330 --> 00:15:34,440
Add child node and we're going to say quarter.

221
00:15:35,050 --> 00:15:40,030
So let's make sure our code is still working mate meaning the ramps are still there same positions and

222
00:15:40,030 --> 00:15:41,700
that they are rotating.

223
00:15:41,710 --> 00:15:48,610
So it's run the app and see secret button and they are rotating.

224
00:15:48,610 --> 00:15:53,600
Sure enough they're rotating and this looks really really good.

225
00:15:53,600 --> 00:15:53,870
Cool.

226
00:15:53,870 --> 00:15:58,060
So what we've done is we've just refactored our code we've cleaned it up we've made it more reusable.

227
00:15:58,100 --> 00:16:04,670
And now what we can do to stop this is we can go into our ramp placer which I'm already here and now

228
00:16:04,670 --> 00:16:06,760
we can actually place the ramp.

229
00:16:06,770 --> 00:16:14,100
We can we can use that those same functions that we just used and place the ramp somewhere on the screen.

230
00:16:14,120 --> 00:16:14,670
OK.

231
00:16:14,900 --> 00:16:19,860
So it should be as simple as Plett ramp equals.

232
00:16:20,330 --> 00:16:25,680
Well shoot we don't know which we don't know which ramp to ramp to use.

233
00:16:25,700 --> 00:16:29,950
We know the selected name of a ramp but we don't know which one to use.

234
00:16:30,080 --> 00:16:33,090
So we probably need to get one more function in our ramp here.

235
00:16:34,110 --> 00:16:37,790
So we can actually just determine which ramp to get.

236
00:16:37,800 --> 00:16:39,240
So I'll put up here at the top.

237
00:16:39,240 --> 00:16:46,640
A new function we're going to say class phunk get ramp for name.

238
00:16:46,680 --> 00:16:47,230
All right.

239
00:16:47,400 --> 00:16:52,420
Or to say ramp name of type string.

240
00:16:52,620 --> 00:16:53,080
Perfect.

241
00:16:53,100 --> 00:16:56,080
And we're going to return an Essene node.

242
00:16:56,490 --> 00:16:58,520
We're simply going to switch the ramp name.

243
00:16:58,570 --> 00:16:59,230
That's all.

244
00:16:59,460 --> 00:17:00,020
All right.

245
00:17:00,060 --> 00:17:01,380
No big deal.

246
00:17:02,100 --> 00:17:09,880
So if the case is pipe Let's go ahead and just return the ramp that pipe.

247
00:17:09,990 --> 00:17:10,700
All right.

248
00:17:10,920 --> 00:17:23,130
And then if the case is quarter let's return ramp get quarter and if the case is pyramid let's just

249
00:17:23,220 --> 00:17:34,980
return the ramp get pyramid like so and the default we will return the ramp get pipe like so

250
00:17:38,430 --> 00:17:39,250
that should work.

251
00:17:40,660 --> 00:17:41,570
It's giving us an Erich's.

252
00:17:41,560 --> 00:17:47,940
It did not return this wonderful wonderful go away read as we go.

253
00:17:48,120 --> 00:17:49,280
Ok cool.

254
00:17:49,310 --> 00:17:56,240
So back to rent place or now we can actually get our ramp just by passing in the name of the ramp so

255
00:17:58,070 --> 00:18:07,200
let's ramp equals ramp get ramp for name and we're going to pass him the selected ramp.

256
00:18:08,110 --> 00:18:15,310
And what we actually need to do here is if the left ramp name equals select the ramp because it's an

257
00:18:15,310 --> 00:18:15,870
optional.

258
00:18:15,910 --> 00:18:19,810
And it may or may not have a value in it and we don't want to crash.

259
00:18:19,810 --> 00:18:26,080
So this is a time when a user could actually have not done something correctly and it could be nil.

260
00:18:26,110 --> 00:18:29,170
And so we want to make sure we account for it here with the optional.

261
00:18:29,620 --> 00:18:32,510
And in this case we will not say ramp name.

262
00:18:33,070 --> 00:18:34,410
Okay so there's our ramp.

263
00:18:34,660 --> 00:18:39,060
And then let's go ahead and give it a position.

264
00:18:39,070 --> 00:18:43,340
So I tab.

265
00:18:43,990 --> 00:18:44,430
Okay.

266
00:18:44,650 --> 00:18:50,070
So the ramp up position is going to be equal to the position or the the finger tap.

267
00:18:50,110 --> 00:18:57,010
Okay like so and then for the scale we want to set the schedule back to normal size.

268
00:18:57,010 --> 00:19:00,100
Remember on the on the list with three items made it really small.

269
00:19:00,100 --> 00:19:04,790
We want to do the default size so ramped up scale is going to be equal to.

270
00:19:04,800 --> 00:19:15,460
Vector 3 make and we're going to say point zero 0.01 0.01 and 0.01 So we're just getting it back to

271
00:19:15,460 --> 00:19:27,040
its default size so it's nice and large and we're going to say seen view that scene the root node and

272
00:19:27,170 --> 00:19:35,120
child node and we're going to pass in the ramp and that would just fetch from our ramp class.

273
00:19:35,840 --> 00:19:36,590
Cool.

274
00:19:36,920 --> 00:19:38,630
This is really cool.

275
00:19:38,630 --> 00:19:41,010
I'm really curious to see if it works.

276
00:19:41,390 --> 00:19:45,050
So in order to test this we're going to actually have to use it on a device.

277
00:19:45,080 --> 00:19:46,860
So let's do that now.

278
00:19:48,170 --> 00:19:52,730
So I've got my actual phone attached here and I am using the cable you can use the Wi-Fi building but

279
00:19:52,730 --> 00:19:57,890
it's a lot slower that I found so the cable is much faster and I'm going to run it and make sure we

280
00:19:57,890 --> 00:20:00,390
don't have any crashes make sure everything works.

281
00:20:00,590 --> 00:20:05,060
And it may not work perfectly because my office right here is really dark and it needs light in order

282
00:20:05,060 --> 00:20:06,150
to process this.

283
00:20:06,260 --> 00:20:10,230
But I at least want to see if something gets on the screen.

284
00:20:10,230 --> 00:20:11,670
So I'm running the app here.

285
00:20:11,900 --> 00:20:17,640
And of course we see the big half pipe from before because it loads by default when we get rid of that.

286
00:20:17,660 --> 00:20:22,320
I think we need to delete the one that's coming up by default so I'm going to stop this real quick start

287
00:20:22,400 --> 00:20:24,440
my recording on my phone.

288
00:20:24,530 --> 00:20:27,500
I was loving the new screen recording pretty nifty.

289
00:20:27,500 --> 00:20:32,900
And let's make sure we get rid of any default half pipes on here yeah this pipe that DA.

290
00:20:33,090 --> 00:20:40,280
Well we actually want to do is create an empty scene here let's just create a new scene file new file

291
00:20:41,480 --> 00:20:49,520
we want to do resources and a scene kit scene file and I'm just going to call this main main scene here

292
00:20:49,970 --> 00:20:55,020
save it and I'm just going to put this over here in the our assets folder.

293
00:20:55,340 --> 00:20:59,150
And what I want to do is we go to empty scene which is fine.

294
00:20:59,150 --> 00:21:00,890
So this is good.

295
00:21:00,950 --> 00:21:10,940
What I want to do here is go to our ramp placer and I want to just load this new scene instead this

296
00:21:10,940 --> 00:21:19,220
main scene here OK so we're going to do is change this from pipe that DADT to main s c and.

297
00:21:19,550 --> 00:21:20,520
OK.

298
00:21:20,580 --> 00:21:30,360
And what I also want to do here on the scene we're at is type in scene view auto enable default lighting

299
00:21:30,360 --> 00:21:32,610
to true to set default lighting here.

300
00:21:33,060 --> 00:21:33,610
OK.

301
00:21:34,080 --> 00:21:37,160
So let's go ahead and run this again.

302
00:21:37,350 --> 00:21:45,140
We record it on my phone and run it OK it's running in the big huge half pipe is gone.

303
00:21:49,100 --> 00:21:53,140
I'm trying to tap but nothing is happening.

304
00:21:56,120 --> 00:21:58,800
Oh A.B. I know why it's not because we haven't selected one yet.

305
00:21:59,090 --> 00:21:59,890
That's why.

306
00:22:00,290 --> 00:22:05,500
Let's select an object analyst at the pyramid.

307
00:22:05,700 --> 00:22:10,820
We also forgot to dismiss the view controller tap off though and it dismisses fine.

308
00:22:10,880 --> 00:22:13,750
Let's tap somewhere and there it is.

309
00:22:13,760 --> 00:22:14,780
It's definitely working.

310
00:22:14,930 --> 00:22:18,170
As you can see but it's it's found a bad surface here.

311
00:22:18,170 --> 00:22:19,290
Again it's really dark.

312
00:22:19,310 --> 00:22:20,440
You see him moving around here.

313
00:22:20,450 --> 00:22:21,840
You have to do a lot of this.

314
00:22:22,040 --> 00:22:26,280
It's really dark here and it's just not placing it in the right spot.

315
00:22:26,330 --> 00:22:30,980
And so of course we're going to build tools to fix this but also the room is not a great test for this

316
00:22:30,980 --> 00:22:33,860
because it's very dark and it can't detect the walls and the surface very well.

317
00:22:33,860 --> 00:22:38,690
But it did place it there and it's the right size in my opinion so very cool.

318
00:22:38,690 --> 00:22:40,550
So it's definitely working.

319
00:22:40,790 --> 00:22:44,920
We just need to make it a little more accurate so.

320
00:22:45,140 --> 00:22:45,950
So it's working.

321
00:22:45,950 --> 00:22:46,640
We did it.

322
00:22:46,730 --> 00:22:50,720
And if you're going to find yourself when working with our kit you're going be running outside of the

323
00:22:50,720 --> 00:22:52,130
house a lot and moving around.

324
00:22:52,130 --> 00:22:57,440
At least I did when I had to build this made many many trips because the rooms just not a good example

325
00:22:57,440 --> 00:23:00,950
especially since we're doing ramps like High-Fives they need to be really big and it's not going to

326
00:23:00,950 --> 00:23:02,310
fit in my house.

327
00:23:02,480 --> 00:23:07,010
So we're going to call this video done what we've done is we've actually we refactored some code so

328
00:23:07,360 --> 00:23:13,250
our our assets are usable are seen files are usable and then what happens is we tap on the screen and

329
00:23:13,360 --> 00:23:18,620
it does detection and then we get the point we grab the ramp and we place it there and it's actually

330
00:23:18,620 --> 00:23:19,760
we've got our quit working.

331
00:23:19,760 --> 00:23:23,000
We've accomplished what we need to do but we need to do more cleanup.

332
00:23:23,000 --> 00:23:28,280
Now we need to implement controls removing things and create a better solution here altogether so that's

333
00:23:28,280 --> 00:23:28,770
it for now.

334
00:23:28,790 --> 00:23:30,330
Let's finish this up.

335
00:23:30,380 --> 00:23:32,750
Mark Price a dove slopes dot com see assume.
