Okay, so in this episode, we want to finish off our player. Our player right now is just a generic sphere. But we actually want to change that because we've got a model of our player. So we can use two different materials. So if we go to our player, and we can see all the things that our player has on it, if we just turn this off, and we can rename this temp, and then we can go to our models, and we can drag our player in, you see that a player is probably too big. So let's make the scale 50 by 50 by 50, rotation zero.
Cool. Now you'll see that if we click on our model, we have two materials here, we can extract these materials, and we can put these materials inside of our materials folder. Cool. If we go over to materials now, you'll see that they're here. And if we change them to curve world shape, Everything will fit nice and snug. Beautiful.
Now, if we press play now, nothing will happen. But basically a player is moving forward like this and not actually rotating we need to actually code in some functionality for the rotation. But for us to actually test us out and to work we need to put over all all the components on here to get it to work correctly. So we need a Speak louder. Hey rigidbody player script, a score script and an audio source. So let's do that.
We can actually copy the components by moving over and just copying and ponent paste component as new copy component. pairs component is new. Sub component, paste component as new copy component Paste component as new. So the reason it's good to copy instead of just creating only components because that fills in all this information, the only other thing that we'll need to do is go over to a camera. And we can actually drag out player into this section. As scene manager, we can actually drag out player into this object spawn script here.
And we can also drag our player into this app initialize script here. And we can make sure our player is tagged as player. And then you'll see when we play the game and press play. Oh, we die straightaway. Why is that? Let's have a look.
So App Player has. See what the problem what the problem is. So we have a sphere collider here. And a sphere collider has come over from our other game object, but you'll see that now I bet you Yeah, so the clutter is actually huge. And the Reason that's so big is because we copied it over from our last. Let's remove them a couple of my last game object, but this one is 50 times larger in scale.
So we're just going to add a smaller sphere Collider. Cool, and that looks good. Let's just press play. Awesome, say scoring works. Getting hit works. Awesome.
Everything looks fun, except our player doesn't actually rotate, which was happening before. It's just that our material didn't show that that that was actually happening. So to fix this, let's go into our player script and add some code. So scripts player. So underneath our line of code here that actually moves the player forward, we want to say Transform dot rotate vector three dot right, I think right will work. And we want to times that by get component rigidbody dot velocity dot z.
So that is the speed that we're moving in the four direction. That's how fast we want to move the maybe divide that by four. So it's just not so fast because that'll be a pretty fast number. So if we go back over to unity, and we press play, so everything's zero on our new player object. Awesome. Cool.
If you wanted our sub works, as we would expect it if you want things to move faster, we can get rid of this or or change the number there. Go back to unity press play. And you can see it's quite fast. And you'll see that when we stop. And if we go over and we go to player, you'll see it's actually stopped as well, which is what we want. And but let's I'm going to leave that at, divided by maybe three and faster.
So that looks like cool. That looks pretty good to me. Now we could actually if we wanted to rotate this, say we wanted to rotate it 90 degrees. What we could do is we could go into here instead of saving three rocks, they backpedal forward. Because remember, now it's rotated and we could press play. That's a little bit tricky, but you get the idea.
Awesome. I'm going to revert that back to what we had last before. Cool. I'm pretty happy with that. So now we have our new model in the game, I would just want to get the player and just make this zero again because I like it the face this way. And we don't actually need to play a temp anymore.
So get rid of that. And let's just play tests, make sure everything is working. Okay. And everything looks to be working fine if we crash, press Add Awesome. Cool. Everything seems to be working fine.
So there you go. So we have a new model in the game, which has different materials. The if you actually go into the materials, you can change, obviously the color of these if you wanted to a different color. But I'm just gonna leave it at the color that was because I like that. And yeah, there we go. So I'll see you in the next episode.