Welcome back.
Our projects coming along well.
We have a bowl instead of a bowl.
I want to have an actual snowboarder in there.
First of all, what I'm going to do is click on the bowl and rename it from bowl to Barry, because
that's who I decided the player would be called and I'm going to change it.
So it looks like a Barry.
And I've given you in the download that we had a few lectures back, given you some assets, the top
and the bottom of the snowboarder, and we're going to replace our ball with the snowboarder, but I'm
going to see how you go with this as a challenge.
So the challenge is to add a character.
You can either use our character or you can download or even make your own character if your heart desires.
I'd like you to add the character in place of the ball and to have a try at adding the components you
think that our character needs so that it's ready to be a snowboarder.
So there you go.
The easy challenge plus video.
I'll see you back here when you're done.
Now let's click on Barry.
What is it that makes Barry look like a circle or look like a ball?
It's because we have this sprite renderer with a circle in there, so I'm going to remove that component.
Now we can see that we've got collision on there, but we don't have the we're not rendering the particular
the ball.
We're not seeing the ball.
I also don't want the Circle Collider because Barry is shaped a little bit different to that.
So I'm going to right click remove that component as well.
So now we just have an empty thing with a rigid body on it.
That's cool.
We need a rigid body.
We'll leave that there.
What I'm going to do is to drag in the bottom of Barry so that he's a child underneath the Barry parent.
We've talked about this a little bit, but essentially what's that saying is the parent game object
has a location in the world.
You can see -6.3, 1.4, three.
That's where it is in the world.
If I was to click W and move that around, you can see that the position of the Barry game object,
the parent game object, parent of the high level children underneath is going to move around.
That's cool.
But we've got a problem here that this is the middle of Barry and these are his legs all the way over
here.
If we click on the child, you can see that the child also has a position.
The position of children in game objects is relative to the parent.
So if I put this at zero on the X and zero on the Y, the legs will be right underneath where the Barry
parent game object is.
And then if I go and move the Barry parent game object to say Y is higher, you can see it moves the
legs as well.
So it's just important to note if you're having an issue with things not being in the right place,
maybe it's because your children aren't zeroed in.
And we'll change this in a moment because we need do a little bit of moving around in here.
But you want it mostly right underneath where the parent is.
Next I'll grab the border top, drag that over onto the Barry game object as well.
I'm just going to reorder them.
Just drag this up and see the little blue line there.
If I drag it above border bottom, it will be above allows to drag something and you can see it goes
gray.
That's going to make it a child underneath that other game object.
So this is a child under a child under a child, a grandchild, if you will.
If I drag it back up, get the blue line, and then you can see it will be at the same order.
The indentation shows the order of the parenting.
Now the top is way off over there as well.
Once again, if I was to move Barry around, it'll move both these pieces.
But we want to get the top by clicking on the top and click on W and move it over to roughly where the
bottom is.
Now if we click back on Barry, you can see the center of the overall game object, the bottom and the
top is around the bottom ish of our object.
And when we rotate, it's going to rotate around this pivot point.
So what I could do is grab the top and the bottom just by clicking shift and then my left mouse button.
So now I'm moving the children game objects.
I'm going to move them down a little bit.
Then when I click back on Barry, you can see the middle of Barry or where Barry the parent is in the
world in relation to where the children are or the children are kind of right in the middle of where
the parent is, which is pretty good.
I just need to move the top a tiny bit, so it lines up.
Now, if we were to click on play, what's going to happen?
I have a feeling Barry's going to not behave well.
We'll just float down behind the world.
One thing I noticed just then is Barry went behind the world when he dropped around behind.
So I'm going to click on board top and shift and click again to get both of them order in.
Later, I'm going to put this at, say, ten so that he's always appearing over the top of the world.
He's not going to float around beside the back of it.
I think that's going to look a little bit nicer now.
The next thing I want to do is to give Barry some collision so that the board actually touches our world.
And it's a little bit finicky to do this because you can see our board is slightly rotated.
So I'm going to just well, I've got my top and bottom selected, just hit E and rotate everything so
that it is as straight as possible.
Because now when I click on Barry, I'm going to add a collider at this top parent level and let me
show you that.
So if we click on Barry, we add component, I'm going to add a capsule collider to DH.
I can modify this pretty easily.
I first of all want to make it a horizontal so it's a lefty righty instead of an down e and the size
of this, let's see, the Y is to fat.
I'm going to move the x wider and the Y a little bit smaller so you can see it's a little bit thinner.
I'm just going to make it the same shape as a snowboard.
Now I can on the Y offset, you can see over here on the right under capsule collider I'm just moving
the size and the offset by mousing over the letters.
I'm going to mouse down there.
So it's a roundabout where the bottom of our snowboard is now.
It's all lined up nicely.
And like I say, the collider is at the Barry level, whereas the graphics are at the child level.
So parent and children relationship there.
Now when I click on play, I'm expecting that Bauer is going to go up and just slide down the hill.
Well, he did go boop, but he didn't slide.
And why is that?
Well, that's because the amount of gravity that's pushing down on Barry and the friction isn't enough
for it to slide along with this capsule.
Collider And that's okay because we're not going to try to push our snowboarder along using just plain
old gravity, because then what's going to happen?
Well, down the hill it'll pick up speed and then up the hill.
To go very slow.
It makes it difficult for us to have a consistent game.
So the way we're going to resolve that is by using effectors, which we're going to do in the next lecture.
And the one last thing I'll do while I'm here is I know that at some point we want Barry to be out of
crash, so we need a different sort of collision detection to do that.
So I'm going to click on Barry once again.
It's going to roll up a couple of these for the moment, just so I can see add component and we'll add
a collider to DH.
What should we add?
We'll add a circle collider to dates right in the middle of it.
Once again, we can modify this by clicking on our radius and making it smaller and then our offset
to move it up a little bit and to the right a little bit.
And I'm going to put this right over the top of his noggin to say, if you bump your head, then bad
things are going to happen.
So we won't use this just yet, but we've got this here for when we do want to set it up so that when
you do bump into something, we can set this up as a trigger.
You know, I might even just click on trigger at the moment.
So we've got this trigger volume on his head for in future lectures where we want to have it so that
he can actually crash.
So there we go.
That's all I wanted to do here.
We've talked a little bit about parent child relationship.
We've got Barry, our snowboarder, set up with his graphics, all nicely aligned.
We've got some collision under the snowboard so that he can actually start moving along, colliding
with our world in the right place.
So good stuff.
I will see you in the next lecture.