﻿1
00:00:03,990 --> 00:00:05,010
‫Welcome back.

2
00:00:05,220 --> 00:00:08,580
‫In this video, we're going to talk about possession now.

3
00:00:08,580 --> 00:00:11,060
‫We're not talking about demons infesting your body.

4
00:00:11,070 --> 00:00:14,190
‫We're talking about controlling pawns in the world.

5
00:00:14,190 --> 00:00:18,830
‫So let's talk about how we can designate a pawn to be possessed.

6
00:00:18,840 --> 00:00:26,130
‫So we're back here in the ED and we have several pawns in the world now by default, none of these are

7
00:00:26,130 --> 00:00:29,230
‫designated to be possessed by a controller.

8
00:00:29,250 --> 00:00:31,320
‫That means we cannot control them.

9
00:00:31,320 --> 00:00:37,470
‫If we press play, we'll see that we have the ability to move around with the WASD keys.

10
00:00:37,650 --> 00:00:41,010
‫That's because we are controlling the default pawn.

11
00:00:41,040 --> 00:00:46,920
‫This is something built into the engine and it will be there for us if we do not designate one of our

12
00:00:46,920 --> 00:00:48,660
‫pawns to be possessed.

13
00:00:48,690 --> 00:00:54,510
‫Now, the way to designate a pawn to be possessed is to select the pawn instance in the world.

14
00:00:54,510 --> 00:00:55,890
‫And in the details.

15
00:00:55,890 --> 00:01:00,270
‫Panel search for a variable called auto possess player.

16
00:01:00,390 --> 00:01:06,690
‫Now Auto Possess Player by default is set to disabled, but if you click the dropdown, you'll see player

17
00:01:06,690 --> 00:01:08,190
‫zero through seven.

18
00:01:08,220 --> 00:01:12,380
‫Now these are not talking about multiple players in a networked multiplayer game.

19
00:01:12,390 --> 00:01:19,140
‫These would be multiple players on a single instance of the game, such as in a split screen game where

20
00:01:19,140 --> 00:01:22,020
‫two people are playing on the same console or computer.

21
00:01:22,050 --> 00:01:25,590
‫So for our game, this will always be player zero.

22
00:01:25,620 --> 00:01:32,100
‫Now what you do is you set this to Player zero for the pawn you would like to possess, and then when

23
00:01:32,100 --> 00:01:36,800
‫the game starts, that pawn will be the one possessed by player zero.

24
00:01:36,810 --> 00:01:41,420
‫And again in our game there is only one player and that is player zero.

25
00:01:41,430 --> 00:01:45,780
‫So as a challenge, I'd like you to experiment with this possession thing.

26
00:01:46,230 --> 00:01:50,230
‫Set auto, possess player to player zero on one of the turrets.

27
00:01:50,250 --> 00:01:51,090
‫See what happens.

28
00:01:51,090 --> 00:01:55,230
‫Press play and observe the results of setting this variable.

29
00:01:55,530 --> 00:01:57,700
‫Then try setting it on the tank.

30
00:01:57,720 --> 00:02:04,670
‫Now you're going to need auto possess player set to player zero only on one of the pawns at a time.

31
00:02:04,680 --> 00:02:10,050
‫Otherwise the engine doesn't know which one you mean to possess, so it's just going to pick one for

32
00:02:10,050 --> 00:02:10,450
‫you.

33
00:02:10,470 --> 00:02:15,960
‫So make sure auto possessed player is disabled on all pawns except for one at a time.

34
00:02:16,470 --> 00:02:19,500
‫Pause the video and experiment with possession now.

35
00:02:22,570 --> 00:02:22,960
‫Okay.

36
00:02:22,960 --> 00:02:28,330
‫So the first thing I'm going to try is I'm going to select one of the pond turret instances and set

37
00:02:28,330 --> 00:02:30,850
‫its auto possess player to player zero.

38
00:02:31,000 --> 00:02:34,690
‫Now if I hit play, I'll see that I'm stuck to this turret.

39
00:02:34,690 --> 00:02:39,850
‫And of course I can't move around or anything because we haven't programmed any movement and we're not

40
00:02:39,850 --> 00:02:41,890
‫even going to for the turret anyway.

41
00:02:41,890 --> 00:02:43,630
‫So this is not very exciting.

42
00:02:43,630 --> 00:02:47,710
‫It's actually kind of frustrating because we're stuck to this turret and we can't move around.

43
00:02:47,710 --> 00:02:49,780
‫We just see the tank sitting there.

44
00:02:49,780 --> 00:02:55,840
‫So I'm going to hit stop and with that same pond selected, I'm going to change this auto possess player

45
00:02:55,840 --> 00:02:57,180
‫back to disabled.

46
00:02:57,190 --> 00:03:00,290
‫Now the next thing I'm going to do is select our tank.

47
00:03:00,310 --> 00:03:05,860
‫Now, you may have noticed as soon as you selected the tank in the world, we have a little pop up window

48
00:03:05,860 --> 00:03:09,020
‫showing us the view from that tank camera.

49
00:03:09,040 --> 00:03:14,050
‫Now, this is a nice built in feature because it's showing us the view that we would have from this

50
00:03:14,050 --> 00:03:16,420
‫camera if we were possessing the pond.

51
00:03:16,420 --> 00:03:21,760
‫And we can see that if we set auto possessed player to player zero for the tank.

52
00:03:21,880 --> 00:03:24,970
‫Now let's go ahead and hit play and check it out.

53
00:03:24,970 --> 00:03:28,240
‫We see the view from the point of view of that camera.

54
00:03:28,240 --> 00:03:29,680
‫So that's pretty awesome.

55
00:03:29,770 --> 00:03:35,610
‫Now again, we can click in the viewport and try to move around, but we have not handled any input.

56
00:03:35,620 --> 00:03:38,880
‫We're not changing its location with anything in the code.

57
00:03:38,890 --> 00:03:41,800
‫That's something that we have to implement ourselves.

58
00:03:41,800 --> 00:03:47,230
‫But the possession part actually controlling the pawn that we are now accomplishing.

59
00:03:47,230 --> 00:03:54,760
‫So in summary, we learn how we can possess a pawn and that by setting its auto possessed player variable

60
00:03:54,760 --> 00:03:57,490
‫to player zero is the way to do this.

61
00:03:57,490 --> 00:04:03,220
‫So now that we're possessing the pawn, it's time to control and move the pawn and that we will cover

62
00:04:03,220 --> 00:04:04,570
‫in the lectures to come.

63
00:04:05,260 --> 00:04:06,430
‫Exciting stuff.

64
00:04:06,610 --> 00:04:07,510
‫I'll see you soon.

