So far, we've created a waypoint system around these palm trees for the tanks, but when we press play,
it's pretty lackluster the way that they move around because there's no physics on them.
So they're just going to clump together and go around the track.
They're not going to hit each other or get each other off course, and they're all going at the same
speed.
So, you know, that's pretty boring.
Once you start adding physics into a system, you basically kind of lose a little bit of control of
what's going on.
And therefore, you need to kind of consider all the things that could go wrong when the physics happens
and be able to correct them.
So let's have a look at one technique that we can use when the physics added to this kind of waypoint
system causes a little bit of havoc.
First of all, let's select all of our tanks.
So if you just shift, select all of the tanks, we're going to add a box collider to them.
And you can see the box collider sitting on those.
And if I just get in a little closer here.
Can't quite see it in this view yet, but there is a box collider inside and when they get a little
bit bigger you'll be able to see it.
And also at the same time, let's just add a rigid body because we need that for the physics system
to consider these tanks as solid objects.
Now with your Box Collider, you can modify it.
And because you've got exactly the same model, which is the tank and you can see each of the colliders
on, they can actually just resize them all at the same time.
So we need to make it a bit taller.
So let's just increase the height of them.
We also need to make them a bit longer in the Z direction and then we also need to move it forward a
little bit in the Z direction as well, and also move it up.
Make sure that you move it up to a point that you can see it above the ground here.
Otherwise your tank is going to fall through the ground.
When you press play, let's just move it around.
So there's a line here.
I've just brought that up above there and now that's a better view there.
You need to make it a bit wider in the X, so let's change the x size to make the tank a little bit
wider.
And then just have a look at what we've ended up with.
Not too bad there's a bit of room in front, but that's okay now for our purposes.
Right.
So they've all got a collider on them, the rigid body.
We're going to freeze the rotation, so go down to constraints and in the freeze rotation, freeze the
X and the Z.
So the tank doesn't actually flip over.
It's only going to go around its Y axis, which is the up axis.
Okay.
We're ready to now play and have a look what happens.
So press play and initially some tanks are thrown off course, but then they come back.
You would have seen those two.
They're the green and the yellow.
Let's have another look.
They have to hit that waypoint in order to come back because they have to go to each waypoint in succession.
Let's make this a little bit more interesting by changing the values on each tank for the speed and
the rotation.
So let's make the yellow tanks rotation 15 and it speed five.
So we'll actually slow it down.
Let's make the blue tank go really fast.
So 50 and we'll give it a rotation of eight.
The red tank can go at 15, we'll leave that at ten.
And the green tank, let's make that go at 40 with a rotation of three.
All right.
So let's now just to make it really interesting, select you select all of your tanks and control D
to make a duplicate.
A lot of them then hit the W key and go over in the scene and just move those tanks out and do it again.
Like that and oh, let's do it again.
So we got some more.
Lots of tanks.
All right, so now let's have a go and see what it does to our situation.
Okay.
So because of the initial physics and because of the settings on the car, the different settings,
some of them are okay, the green cars, well, they've got a really bad turning circle, so they're
getting stuck a fair bit.
Now, this green car over here we have a look, has obviously made it all the way around the track until
it got to this tree here and then it got knocked off of its course and has now gone around the tree.
And you might have seen just then there was another green car that must have got knocked back onto course
by another car and ended up coming around because now it is at this tree here because they have to go
round in succession in order for them to actually progress.
So this is a bit of an issue if cars can get stuck at a waypoint, especially in a race.
So if you miss a waypoint and I said this previously, then you want to sort of get back on the track
without trying to hit an actual single location, right?
So in order to do that, you need to create an object that's going to follow the track around and then
have your tank follow that object.
So you want it like a super accurate progress tracker is what we're going to call it that stays on the
track and then the tanks actually follow it instead, and we'll come back and implement that in the
next video.