WEBVTT

00:13.600 --> 00:19.840
Now we're going to have a look at the behavior called evade, evade is pretty much exactly the same

00:19.840 --> 00:26.850
as pursuit, except that it's going away from a predicted position instead of going towards it.

00:27.190 --> 00:32.360
So instead of seeking a predicted position, we actually want to flee from it.

00:33.040 --> 00:37.420
So I'm going to do now is give this to you as a challenge to right.

00:37.420 --> 00:39.190
The evade method.

00:39.730 --> 00:46.420
Given what you already know about pursuit and seeking, you should be able to put together and evade

00:46.420 --> 00:47.950
with a fleeing.

00:48.790 --> 00:50.340
So pose a video now.

00:50.380 --> 00:54.010
And when we come back, I'll show you how to put it into action.

00:54.910 --> 00:55.300
All right.

00:55.300 --> 00:56.500
How did you go with that?

00:56.530 --> 01:00.600
Let's have a look at what we need to do to create and evade.

01:00.900 --> 01:07.030
So, first of all, let's create the outline for our evade so evade.

01:08.050 --> 01:17.260
And you could almost grab all of what's in pursuit, put it into here and change the seat into flames.

01:17.620 --> 01:18.810
Now, I'm not going to do that.

01:18.820 --> 01:24.580
What I'm going to do instead after I just put a down here in the update so that it will run, it is

01:24.580 --> 01:27.190
only take the necessary components from it.

01:27.190 --> 01:35.770
So when we're running away, we're only really concerned about running away from the predicted position,

01:35.770 --> 01:38.400
even if the agent is heading towards us.

01:38.800 --> 01:45.520
So let's just grab this value for our target, DPR and these two down the bottom, which is what we

01:45.520 --> 01:49.660
started with when we created our very first pursue.

01:50.020 --> 01:55.810
OK, so that we had this now in here, I'm just going to change this, seek to flee.

01:55.810 --> 02:00.150
So we're actually going away in the opposite direction to what we were doing.

02:00.760 --> 02:02.740
OK, so how did you go?

02:02.740 --> 02:03.520
Did you get that?

02:03.520 --> 02:06.250
Let's just save it and have a look at what we get.

02:06.260 --> 02:16.060
Let's go back into here and press play, and now we're going to have an agent that's going to evade.

02:18.540 --> 02:24.980
So if I go over here, he's going to start turning away from me.

02:28.960 --> 02:33.430
Try and come back this way, he's going to keep inviting.

02:35.270 --> 02:42.800
OK, so nice and simple, if you lift those if statements in with the angles and that it would be interesting

02:42.800 --> 02:48.260
to see what you came up with it and it probably still works just fine, but is now checking for angles.

02:48.260 --> 02:55.190
But depending on what angles you're using, you might get some odd behaviors where the cop could be

02:55.190 --> 03:00.950
heading towards the robber and the robber could decide that he's going to go straight past the cop to

03:01.130 --> 03:06.320
evade in the sort of in the opposite direction, which would be a bad idea for him to come anywhere

03:06.320 --> 03:08.130
near the cop, which is not what you want.

03:08.150 --> 03:14.480
So back in our code, again, this is all that you need to have in an avowed.

03:15.430 --> 03:18.430
As I said, it's the opposite of pursuit.
