Hello everyone and welcome back to class.
Mark Price here at the slopes dot com.
And what we've done so far is we've got our pop over View Controller with the ceiling view in it and
we are loading the half pipe into it and we've placed it and scaled it etc..
And what we want to do in this video is get the other ones in there.
So let's go ahead and do that now we know we've got a half pipe.
We have a pyramid and we have the quarter pipe.
OK.
So let's do the pyramid.
Next we're going to say let.
Well what we kind of used already we should actually change the name around a little bit.
Let's call this pipe and call this pipe.
Here we go.
And then we're going to say let pyramid because the unseen named Art dot se and assets slash pyramid
pyramid.
DA which is what we've named it.
And then we got that note again.
Maybe what we should do is change these to VAR's and reuse them.
That's even better.
A little bit of refactoring.
No big deal no big deal at all.
And let's just back to RBJ
var B.J. and var node.
And now we can do is just reuse them.
So be equals this they say and node equals OPG dot root node child node with name.
We're going to say pyramid recursively true.
Now if you're wondering hey Mark why are you overwriting your object here won't that replace it in the
scene.
Well no and here's the reason why it's this line of code right here once you've created the node and
we've grabbed it we added as a child node of the scene so now the child node is holding reference to
that.
And so even if we delete this reference here with a new object it's not going replace the object that's
being held by the by the scene itself.
So by this line of code here by adding it to another object or adding a child note that now contains
a reference to the old object which means we're safe to get rid of this object we've been using here
and replace it with the pyramid.
So just one of those things like a little thing that can be very confusing or cause a bug and you have
to kind of understand code and references and how that works.
So again we've got our We've got our object we've got our node.
The next thing we want to do is set the scale and the position of the pyramid.
So we're in say no that scale can be equal to a C and vector 3 make.
And this is zero point zero zero three to zero point zero zero three two and zero point zero zero three
cheerly.
These are numbers that worked for me before.
We may have to adjust.
Which is OK.
Node position equals C-n vector 3 make.
And we're going to say negative zero point nine five negative zero point nine and negative 1 and we
may have to adjust that as well too.
And then seen the root note add child node and we're going to say node like so cool and then move this
preferred content size command x.
And let's just put it right here
OK.
Let's see if this works let's run on the simulator
see iPhone 7 go
in we're running.
It's click the hit an invisible icon here and fix that eventually.
OK.
So we've got this ramp way up here and then we've got this little guy right here it's way too small.
We're going to fix and we're going to want to move it up more towards the middle which is OK.
No big deal.
So bigger and a little higher up.
So instead of 3:2 Let's go ahead and say I want to say 5 2 5 2 and 5 2.
Let's do the size first.
Run it again.
I want to do the size first before I start messing with position so I can make sure that it's in it's
we can adjust accordingly.
A little bit bigger.
I'm going to say 5 8 5 8 and 5 8
perfect that's a good size.
OK.
It's not centered though.
So we'll just say on the X let's do negative 1 and give it a shot.
Cool.
That looks great on the center.
Now let's bring it up a little bit.
It's too low.
Just a little bit.
So we're at negative nine.
So let's say negative.
That's interesting.
So far down negative seven Let's try that.
One negative 0.7
and a little bit higher and say six five
wonderful I think that looks good and we can move it up later if we need to.
So we've got the half pipe.
We have the pyramid and now we just need to get our quarter pipe.
No big deal.
So LBJ equals LCN seen named Art and assets slash quarter DHP and Noad equals root node child node with
name corridor recursively.
True.
And then we'll set the scale and the position of the quarter pipe.
So let's say No dot scale is equal to s c and vector make.
And what do we have here.
We've got four quarter pipe.
We're gonna say I'm going to do the same number as the appears 0 0 5 8 and 0 point 0 0 5 8 and 0 0 0
5 8.
And that looks good.
We're going to say no dot position equals a and vector 3 make and scroll is up here for you.
And what do we want to do for our position.
We want to say negative 1.
And then for this position so we know that going lower these numbers brings it.
What does it do it brings it downwards.
Well actually no.
Point seven is way up there the top So yeah it's going to bring it down so we want to make this even
more so in our in our positioning here.
So let's say what.
Zero negative zero point nine make it even lower.
And then we say negative 1 and then we're going to say seen the root node thought at child node and
we're a note like so let's run it and see if we got lucky and it worked and the very first try at least
that it got in the right spot for us.
All right.
So it's not low enough for sure the size is good though.
I really like the size.
So I just want to bring it even lower.
It's interesting that it's putting it in the same spot point nine Why would that be in the same spot.
X 9.
I'm not really sure let's say negative 2 just to see what happens.
A big change
so negative to get it there but not quite where we want it.
So let's go a little bit lower and say negative 2.6.
We run it.
It's a little too low let's say 2.5.
And I think what we're going to need to do is bring up the pyramid a little bit more.
So negative six point three.
Let's run it.
A little bit better will move the pyramid up and move the quarter pipe up pyramid is going to go to
say 6 0 and quarter pipes going to go to two point two for a run it just testing it out trial on air.
Maybe you're wondering hey Mark White Why didn't you just write an algorithm to make a grid and place
the objects in a grid.
And like I said I could have done that but the math is quite extensive in order to detect how big the
screen is and make things Project perfectly across the screen in a grid system in the 3-D view.
I would probably have made it done this in Spryte kit before I went and did it here in 3D and then just
use 2D images here.
This is quite perfect or I want thanks I just want the pyramid up even more.
So we were going to say point five on the pyramid and there was only three objects so I felt like it
was reasonable just to place them here than to spend a whole hour coming up with an algorithm to put
these in a grid.
Just a decision.
So it was a little bit higher.
We're almost there ladies and gentlemen we say point four five.
Run it again a little bit higher up
click the secret button and I'm going to work with this.
This is good enough for me.
So we're going to call this video done we've gotten three three objects here.
It looks good and placed here strategically.
So we can tap them and then place them on the market screen on this on the A-R CNBLUE.
And this is cool so we're going to call this video done and the next video we're going to get these
rotating.
So they just have a little more life to them for working with 3-D.
They might as well be moving.
So that's it for now.
Marc price at DEF slopes dot.com.
See y'all soon.