﻿1
00:00:04,390 --> 00:00:05,110
‫Hello and welcome.

2
00:00:05,110 --> 00:00:09,040
‫In this lecture, we're going to introduce a new node called the Blend Poses by Boolean, which will

3
00:00:09,040 --> 00:00:12,730
‫allow us to check a checkbox and kill off our character.

4
00:00:12,730 --> 00:00:14,380
‫Let's dive in and see how it works.

5
00:00:15,260 --> 00:00:15,500
‫Okay.

6
00:00:15,530 --> 00:00:20,390
‫So we want to get our character to die when we reduce the health down to zero.

7
00:00:20,600 --> 00:00:27,650
‫So the first place we're going to be looking at is an animation blueprint because that is the place

8
00:00:27,650 --> 00:00:32,540
‫that we're playing our various animations and we want to switch over essentially from playing.

9
00:00:32,540 --> 00:00:38,660
‫If we go over to our anim graph, we want to switch over from playing this blend space over into playing

10
00:00:38,660 --> 00:00:42,230
‫a death animation and basically to never go back from there.

11
00:00:42,500 --> 00:00:48,560
‫So the way we're going to do this is to use a new type of node called a blend by boolean.

12
00:00:48,560 --> 00:00:54,560
‫So if we right click here and look for the different types of blend that we can get in here, I'm going

13
00:00:54,560 --> 00:00:55,180
‫to scroll to the top.

14
00:00:55,190 --> 00:00:58,490
‫There's a whole bunch of blend poses down here that it's selecting for me by default.

15
00:00:58,520 --> 00:01:05,060
‫Don't know why, but if we do a blend poses by boolean, you can see quite clearly that we've got two

16
00:01:05,060 --> 00:01:08,950
‫options here a true pose and a false pose.

17
00:01:08,960 --> 00:01:17,240
‫So basically what we'd want to be doing is to play our BB's blend space locomotion animation when we

18
00:01:17,240 --> 00:01:23,720
‫are not dead, and otherwise we want to play our dead animation as the true pose.

19
00:01:23,720 --> 00:01:30,050
‫And then here we've got some options for how how quickly it's going to blend between the two animations

20
00:01:30,050 --> 00:01:32,270
‫when the Boolean value changes.

21
00:01:32,270 --> 00:01:34,880
‫Now, in our case, we're not going to have players resurrecting.

22
00:01:34,880 --> 00:01:41,270
‫So the most likely case is that we're just going to hit that Boolean once and not go back.

23
00:01:41,840 --> 00:01:43,130
‫So what do we need here?

24
00:01:43,130 --> 00:01:44,690
‫We need a death animation.

25
00:01:44,690 --> 00:01:49,520
‫So I'm going to right click and search for death and see if we can find a few ones here.

26
00:01:49,520 --> 00:01:51,170
‫We've got a death backwards or death forward.

27
00:01:51,170 --> 00:01:55,910
‫So let's just have a look at the differences between those by going to our animation view and we'll

28
00:01:55,910 --> 00:01:59,120
‫look for death in there just to preview those animations.

29
00:01:59,120 --> 00:02:01,090
‫So death backwards.

30
00:02:01,100 --> 00:02:01,730
‫Let's have a look.

31
00:02:01,850 --> 00:02:02,690
‫Let's do that again.

32
00:02:02,690 --> 00:02:05,450
‫So, okay, it's being shot from behind and falling forward.

33
00:02:05,450 --> 00:02:07,400
‫So it's kind of the opposite of what I would expect.

34
00:02:07,790 --> 00:02:09,980
‫Death forward is probably the one we want.

35
00:02:10,010 --> 00:02:12,080
‫Where are you being killed from in front?

36
00:02:12,080 --> 00:02:14,150
‫I think that's what it's trying to say.

37
00:02:14,390 --> 00:02:16,700
‫So let's go and open up the death forward.

38
00:02:16,730 --> 00:02:17,240
‫There you go.

39
00:02:17,240 --> 00:02:19,850
‫We kind of get shot and fall up backwards.

40
00:02:19,850 --> 00:02:21,030
‫So that's the one I'm going to want.

41
00:02:21,030 --> 00:02:25,910
‫I'm just going to dock my shooter animation blueprint to the main window.

42
00:02:26,090 --> 00:02:32,600
‫And in here, we're going to look for death forward and we're going to play that through the true pose

43
00:02:32,600 --> 00:02:38,600
‫and then hook up the output pin of the blend poses by bool to the output pose.

44
00:02:38,600 --> 00:02:43,130
‫If we hit compile now you should see it's playing that BS locomotion.

45
00:02:43,130 --> 00:02:50,180
‫If I hit the checkbox and recompile, you can see it is playing at death animation but note it's looping.

46
00:02:50,180 --> 00:02:56,150
‫So one thing we can do here to prevent that is by selecting that node to play death forward, we can

47
00:02:56,150 --> 00:03:04,220
‫uncheck the loop animation in our details pane over on the right and hit compile and now it should play

48
00:03:04,220 --> 00:03:09,620
‫the death animation and then come to a rest at the end of it and stop, not go any further from there,

49
00:03:09,620 --> 00:03:11,450
‫which is exactly what we want here.

50
00:03:12,570 --> 00:03:15,390
‫It's time for your challenge to add a death boolean.

51
00:03:15,390 --> 00:03:20,430
‫We've been controlling everything else via those variables on our animation blueprint.

52
00:03:20,430 --> 00:03:25,890
‫It's time to add a variable to the blueprint for death and whether we are dead or not.

53
00:03:25,890 --> 00:03:33,390
‫Set the blend based on this variable and then test it without compiling within the blueprint or compile

54
00:03:33,390 --> 00:03:33,750
‫first.

55
00:03:33,750 --> 00:03:39,600
‫But you won't have to recompile every time you flip the switch and you should be able to see it switch

56
00:03:39,600 --> 00:03:43,710
‫between our death animation and our movement animation.

57
00:03:43,710 --> 00:03:49,230
‫And with that information, you should be able to see whether the timings on that blend node are correct

58
00:03:49,230 --> 00:03:49,740
‫or not.

59
00:03:49,740 --> 00:03:52,110
‫So pause the video and have a go.

60
00:03:53,400 --> 00:03:53,650
‫Okay.

61
00:03:53,730 --> 00:03:54,400
‫Welcome back.

62
00:03:54,420 --> 00:03:56,580
‫So hopefully this was fairly simple to do.

63
00:03:56,580 --> 00:03:59,190
‫Let's go into the variables in the my blueprint pane.

64
00:03:59,190 --> 00:04:00,300
‫Add a new variable.

65
00:04:00,300 --> 00:04:04,980
‫It's automatically a boolean for me for some reason and I'm just going to have this as is dead.

66
00:04:05,690 --> 00:04:08,930
‫And that's going to be the state that we're going to then grab from the character in the next lecture,

67
00:04:08,930 --> 00:04:09,920
‫not in this lecture.

68
00:04:09,950 --> 00:04:16,820
‫Going to drag this into our anim graph get is dead and then I'm going to hook it up to our active value

69
00:04:16,940 --> 00:04:18,020
‫like so.

70
00:04:18,020 --> 00:04:23,600
‫And now if we compile we should see is dead show up in the anim preview editor over on the right bottom

71
00:04:23,600 --> 00:04:31,430
‫right and if I check the is dead checkbox then it goes ahead and switches from our locomotion to playing

72
00:04:31,430 --> 00:04:33,200
‫our death animation.

73
00:04:33,440 --> 00:04:34,160
‫Fantastic.

74
00:04:34,160 --> 00:04:36,590
‫So that's what I wanted to achieve in this lecture.

75
00:04:36,590 --> 00:04:40,130
‫And in the next lecture we're going to hook that up to the actual gameplay.

