본문 바로가기
Unreal Engine5/게임 만들기 - Warehouse Wreckage

Unreal Engine Adding an Impulse to Objects

by wanna_dev 2023. 6. 26.

Before getting started, There are some difference in words "Force" and "Impulse".

Force arises over time, whereas impulses are instantaneous.

We did get the reference of the object in the previous article. This time, We will make object do something.

When type "space bar"

There is a Keyboard Event

space bar node

There are two execution pins. Pressed, Released. What we are going to do is printing mass of the cube by pressing space bar.

 

Just connect execution pin to print string's input pin. that's all.

You can see the mass of the cube every time you press the space in the upper left of the preview screen.

 

Now, let's apply impulse on the cube.

1. delete print node, Get Mass.

2. Find "Add impulse"

3. Connect with space bar's pressed execution node.

4. Fill out the value of "Impulse" property

1,2

 

3,4

F = ma Formula

Force = Mass * Acceleration 

Impulse = Mass * Velocity Change 

10000 = 100 * 100

if you hate math, click the option Vel Change and gives z-value 100.