﻿1
00:00:04,300 --> 00:00:05,260
‫Hello and welcome.

2
00:00:05,260 --> 00:00:12,010
‫This lecture, we're going to be enabling physics simulation within our scene so that we can get cubes

3
00:00:12,010 --> 00:00:16,240
‫to move around and things to float as if they were in zero g.

4
00:00:16,270 --> 00:00:18,580
‫Let's dive in and see how this works.

5
00:00:18,910 --> 00:00:24,400
‫So this game is going to be one of physics interaction with objects bumping into each other and creating

6
00:00:24,400 --> 00:00:25,900
‫mess and chaos.

7
00:00:26,110 --> 00:00:30,490
‫Let's have a look at how we can do this sort of thing in Unreal.

8
00:00:30,610 --> 00:00:34,960
‫Let's go over to the minimal default level editor tab.

9
00:00:35,680 --> 00:00:42,280
‫And what we're going to do is by default, none of these objects will actually be affected by physical

10
00:00:42,280 --> 00:00:42,700
‫laws.

11
00:00:42,700 --> 00:00:50,560
‫So if I take this chair and select it and bring it up in the air and then I go ahead and hit play,

12
00:00:50,560 --> 00:00:53,770
‫it just hangs there as if gravity was not a thing.

13
00:00:53,920 --> 00:01:00,550
‫The reason for this is that it is expensive for your CPU to simulate physics, so if it doesn't have

14
00:01:00,550 --> 00:01:05,770
‫to, unreal will not do it for any object in the scene.

15
00:01:06,280 --> 00:01:09,910
‫So we need to go ahead and enable it explicitly.

16
00:01:09,910 --> 00:01:17,140
‫So make sure that the chair is still selected and then let's drag out the details pane so we can see

17
00:01:17,140 --> 00:01:18,220
‫this a little bit better.

18
00:01:18,520 --> 00:01:21,850
‫Now at the top of the details pane is a list of things called components.

19
00:01:21,850 --> 00:01:23,230
‫We don't have to worry about this too much.

20
00:01:23,230 --> 00:01:30,760
‫Just make sure the topmost item is selected and then below the search bar you can see that there are

21
00:01:30,760 --> 00:01:34,060
‫properties and below the search bar there's actually a list of filters.

22
00:01:34,060 --> 00:01:38,470
‫There's general actor, Lod, misc and physics.

23
00:01:38,470 --> 00:01:44,470
‫I'd like you to select physics so that we're seeing only the actor's properties relating to physics.

24
00:01:45,190 --> 00:01:50,680
‫And you'll see that there is a checkbox here labeled simulate physics, and it's currently set to false.

25
00:01:50,680 --> 00:01:58,780
‫If you check that box and hit play, then we get the chair dropping and simulating physics there.

26
00:01:58,810 --> 00:02:02,380
‫Now we can also do this with objects that we add in.

27
00:02:02,380 --> 00:02:09,220
‫So I could go to the quickly add button in the toolbar, go to shapes and cube, and drag a cube in

28
00:02:09,220 --> 00:02:10,840
‫just under the chair.

29
00:02:11,020 --> 00:02:19,510
‫And in fact, I'm going to bring this above the chair and select simulate physics for that cube.

30
00:02:19,570 --> 00:02:25,480
‫If I hit play, then you can see the cube lands on top of the chair and they interact with each other

31
00:02:25,480 --> 00:02:28,900
‫as well as interacting with other objects in the scene.

32
00:02:28,900 --> 00:02:32,830
‫Now there are a couple of other physical properties worth noting here.

33
00:02:32,830 --> 00:02:36,610
‫One of them is the Enable Gravity CheckBox.

34
00:02:36,610 --> 00:02:43,360
‫So if I took this chair and the one with physics enabled and disabled gravity then hit play, you can

35
00:02:43,360 --> 00:02:51,100
‫see the chair just floats as if there were no gravity, whereas the cube still falls as if it has a

36
00:02:51,100 --> 00:02:52,840
‫normal amount of gravity.

37
00:02:52,960 --> 00:02:57,190
‫And then the other property I just want you to take note of is the mass.

38
00:02:57,190 --> 00:03:03,910
‫This is how much something weighs, essentially how many kilograms of substance there is there by default.

39
00:03:03,910 --> 00:03:10,780
‫This is calculated for you, but you can check the checkbox there to give it a mass that you want so

40
00:03:10,780 --> 00:03:14,080
‫you can make something super heavy or super light.

41
00:03:14,080 --> 00:03:21,250
‫So if I make the chair super heavy, you can see it reacts a lot less to the cube falling onto it and

42
00:03:21,250 --> 00:03:24,400
‫it moves much more slowly and sluggishly.

43
00:03:24,400 --> 00:03:28,660
‫So let's challenge you to knock the lamp off the table using the physics system.

44
00:03:28,660 --> 00:03:31,270
‫So enable physics for both the lamp and the table.

45
00:03:31,270 --> 00:03:37,510
‫For this to work, place a large object over the table, presumably with gravity enabled, and knock

46
00:03:37,510 --> 00:03:38,140
‫it over.

47
00:03:38,140 --> 00:03:39,700
‫Pause the video and have a go.

48
00:03:43,320 --> 00:03:43,860
‫Okay.

49
00:03:43,870 --> 00:03:44,750
‫Welcome back.

50
00:03:44,760 --> 00:03:49,710
‫So I can actually use the cube that I've already got to try and knock this over.

51
00:03:49,740 --> 00:03:53,760
‫So I'm going to move the chair so that the cube hopefully lands down onto the table.

52
00:03:53,760 --> 00:03:57,390
‫Then I'm going to select the table and the lamp on it.

53
00:03:57,390 --> 00:04:02,970
‫I can do that with a shift click to select both and I can change the details of both at the same time

54
00:04:02,970 --> 00:04:08,730
‫so I can go ahead and enable physics by clicking the simulate physics checkbox and hit play.

55
00:04:08,730 --> 00:04:10,050
‫Let's see if this works.

56
00:04:10,350 --> 00:04:14,070
‫It landed on the table, but it didn't quite knock it over.

57
00:04:14,310 --> 00:04:20,220
‫So I'm going to make that a bit of a heavier cube by selecting the cube and overriding its mass with

58
00:04:20,220 --> 00:04:24,570
‫the checkbox and setting the mass to 1000 as well.

59
00:04:24,600 --> 00:04:25,740
‫Let's hit that.

60
00:04:25,740 --> 00:04:32,940
‫So a heavier mass meant that the the statue just went flying off the table when it was hit.

61
00:04:32,940 --> 00:04:34,290
‫That's all for this lecture.

62
00:04:34,320 --> 00:04:35,760
‫I'll see you in the next one.

