Unreal Engine 4 Archives

It’s a 3D Game Engine made by EPIC. It brings together 3D concepts, coding and writing. Not everyone can handle that. This is the legacy UE4 category. UE5 has its own.

Setting up an auto fire mechanism in Unreal Engine

Auto-fire means that you can keep holding down a button and a gun in your game keeps firing bullets at a pre-determined rate. No matter how a single-fire mechanism is setup, we can modify it to work automatically. In this article I’ll show you how it works. For this example I’m using the First Person …

Read more

How to tag an actor in Unreal Engine

Did you know there’s a way to specify an Actor object by something other than an a reference? I thought this was a handy trick. iOS has a similar “hack”, and it can save your bacon on occasion. Tagging an Actor in Blueprint In the Class Defaults of your actor object, head over to Actor …

Read more

Setting up a simple AI Controller in Unreal Engine

Unreal Engine can make pawns to things, like chase down and follow the player. This is known as AI behaviour, for Artificial Intelligence. It works surprisingly well! Here’s how to set it up – in its simplest form. In principle we have to create an AI controller add the AI controller to the pawn define …

Read more

How to implement a Blueprint Interface in Unreal Engine

Interfaces are a C thing. They’re a set of functions that one class can implement so that an action is performed on another class of a potentially different type. Rather than calling a function explicitly on another class, we’re sending a message. If the receiving class knows what to do with it, it’ll react. If …

Read more

Refactoring complex Blueprint Code into Functions and Macros in Unreal Engine

The beauty of Unreal Engine’s node system is that it’s relatively easy to extend your application code visually. At the same time, this can lead to extremely messy code (literally spaghetti code, considering the amount of noodles on the screen). While such code may be working in the heat of the moment, your future self …

Read more

Adding Gamepad Navigation for Menu Selections in Unreal Engine

In this article I’ll explain how to add gamepad and keyboard navigation to UI Widgets in Unreal Engine. To my surprise, gamepad navigation magically works alongside regular mouse navigation, as long as Keyboard Focus is set appropriately on any of our UI elements. We don’t need to add any special logic to our project. All …

Read more

How to export assets from Unreal Engine

Something that wasn’t immediately obvious to me is that Unreal Engine saves its own file format under the hood. For example, a prop or audio file is not stored as .OBJ or .WAV, but as .UASSET file. Perhaps it’s just a wrapper that stores binary data, or maybe it’s some other kind of magic. Be …

Read more

How to change the colour of a material via Blueprint in Unreal Engine

I’ve just learnt about a nifty mechanism to change parameters on a material node in Unreal Engine. The niftyness lies in the fact that when we convert static values in the material editor into parameters, which then become the equivalent of public variables that are accessible from other parts of UE4. It sounds way scarier than it is, let me show you how it works in detail.

Read more

What is Yaw, Pitch and Roll in 3D axis values

There’s a slightly weird terminology I keep hearing in various 3D applications. Those terms are Yaw, Pitch and Roll. I have trouble remembering which one is which, and which one is related to what axis in 3D space. I’m more used to the Euler notation system, and the only one I can remember is “roll” …

Read more

Adding subtle wind animation effects in Unreal Engine

I’ve always been marvelling at all the little moving background items in video games. Most trees, grass, plants and such foliage appears to move subtly. How do they do that? Perhaps it’s a wind node? Surely that’ll eat up huge amounts of resources.

I just found a computationally cheaper trick to do this, namely by adding this effect to the plant’s material, thanks to a video by MetalGameStudios. It suggests that we can do this in two ways, both of which are described below. In either case, open the material of your object to proceed.

Read more

How to export Keyframe Animations from Unreal Engine

I’ve just figured out how to setup keyframe animations in Unreal Engine, and thought I’d make a note of it before I forget. I made the animation above a little while ago by “poking around”, but it wasn’t as smooth as I liked it to be. I think I’ve found the missing bits now, so here’s how it works. From what I gather, Unreal Engine calls Keyframe Animations “Cinematics”. They’re a little tricky to setup, because the whole engine is built for so much more, but in principle we need to:

  • create a new Level Sequence
  • create a Cinematic Camera
  • add the camera as a Track to the Sequencer
  • create keyframes for/with the camera
  • add a Camera Cut Track
  • export your animation as a video or image series

I’m going to create a camera animation like in the demo above, but any regular mesh object and Actor can be animated, including lights and their properties, so this process is not limited to cameras. However you need at least one camera to render out the sequence, at least that’s my goal here. The process will be different if you’d like to trigger the sequence from within a game, which is not in the scope of this article.

Let’s see how to do this step by step.

Read more

How to use Event Dispatchers in Unreal Engine

Following on from my earlier article about referencing a Blueprint from another Blueprint, Unreal Engine has another interesting way for inter-object communication. Sometimes we need to reference more than one object, say when press a button and want several objects to react, all in their own different way. Imagine pressing a button and a light goes off, a particle effect gets triggered and several enemies get spawned. Event Dispatchers can do that, and here’s how we can use them.

In this example I’ll have a Switch object, and a Lamp object. When we press the switch, it’ll send out a message to which the Lamp (and other objects) can react. Each object can implement the function and execute different code. I’ll only show the abstracted Lamp code here for brevity, from which I’m sure you’ll understand the gist.

Sadly the terminology “dispatcher” is a little confusing. At least to me, it suggests that an event is dispatched (i.e. sent), whereas in reality the dispatcher is actually the listener rather than the sender. Hence the dispatcher needs to be setup on the event that needs to react. A real-world dispatch worker doesn’t work that way (thanks code people for confusing us non-coders).

Read more

How to make an object invisible in Unreal Engine

I’ve recently had to use a helper object in Unreal Engine (a plane), but I didn’t want this object to be seen when the game was running. In a regular 3D application I would have just clicked that little eyeball icon to hide it, but that would temporarily remove the object from my scene in …

Read more

Creating a Moving Platform in Unreal Engine

I’ve made a simple moving platform in Unreal Engine today. This is used in platform games all the time, be it as a triggered mechanism or an automatically moving always-looping/moving thing. Remember all those gaps you need to cross over a deep ravine, while stone platforms are moving left and right, and you’ll have to …

Read more

Building a Sliding Door in Unreal Engine

I’ve been following Katie’s videos to get my feet wet with Unreal Engine, and thought I’d take a note on how to build her sliding door so I don’t forget. Here’s how I’ve built mine in principle:

  • create a new Blueprint Actor
  • bring in a cube and build an “InnerDoor” piece (that’s the one that will slide up and down)
  • build a frame for the door (will remain static)
  • add a Box Collision and extend it (it will trigger our animation)
  • use a Timeline node to raise the door
  • reverse the process so the door closes

I’m doing it slightly different to how Katie suggests it, but there’s really no right or wrong way. I’ve described how to do something similar with a Level Sequence in another article. Let’s see how to do it with a Sequence Node here.

Read more

Changing Morph Targets programmatically in Unreal Engine

I’ve just found out how to change values for Morph Targets on objects in Unreal Engine via code. This will come in handy when any attribute needs to be updated either as a result of user input, or via automation. Here’s the basic workflow:

  • know the exact name of the Morph Target
  • add a Set Morph Target node in Blueprints
  • populate it with the name of the morph
  • give it a value (between 0 and 1, equivalent to 0% to 100%)

Here’s a small example that continuously changes my Genesis 8 character from Basic Female into Olympia. While not particularly useful in itself, it illustrates how a parameter change can trigger a morph.

Read more