Category: Physics

Generating Hit Events

falling_actors

Unreal Engine 4 provides an easy way to generate Hit Events. We have two different types of Hit Events:

OnHit event, which fires when the actor hits something
Receive Hit event, which fires when the actor gets hit by something

Let’s see how we can use these functions.

Creating a Falling Actor

In this post, I’m going to create two……


Generating Overlap Events

overlap_events

In Unreal Engine 4 provides an easy way to generated overlap events. Overlap events consist of BeginOverlap and EndOverlap. In this tutorial I’m going to create a custom trigger that uses both functions.

Creating a Custom Trigger Box

In order to create a custom trigger box add a new C++ class which inherits from the TriggerBox class…….


Adding Radial Impulse to Actors

radial_impulse

One can best describe the Radial Impulse as a bomb explosion, emitting force from it’s core to all nearby objects.

Creating the necessary parameters of the “Bomb” Actor

Create a class which inherits from Actor. To create a Radial Impulse we need:

The origin of the impulse
The radius of the impulse
The strength of the impulse
The impulse fall off distance (this……


Adding Impulse to an Actor

apply_force

The difference between the Force and Impulse is that Impulse is recommended for one time instant burst. To apply an impulse to an Actor, follow up this tutorial but in the logic of the MoveChosenActor type in the following code:

PS: I’m aware of the fact that we are not adding a force in this case,……


Adding Force to an Actor

apply_force

Sometimes, we need to apply a force to an Actor. The force we apply is like a “thruster”. It’s good for adding a burst over some (non zero) time and it should be called every frame for the duration of the force. In order to apply a force you need a Primitive Component.

In this tutorial however, I won’t……


Tracing multiple objects

endresult

In this tutorial I’m going to create a trace for multiple objects. While Unreal Engine provides a set of different shapes that developers can use in this post I’m going to create a sphere. Here is the end result of the tutorial:


Single Line Raycasting

raycast_output

Raycasting is a special collision technique in which you emit a single ray (in this case at least!), with fixed length, origin and direction that has a Hit Result which contains information about the Object or Actor that the ray collided with.

For this post, I’m going to use a FirstPerson C++ Template. I will create……