Unreal + Blender Tutorial – How to add root bones / motion or keep animations in place

By | Development, Tutorial, Unreal | No Comments

Hey guys,

Today we are going to roll into the New Year by adding in root motion to our kick animations as well as convert them to stay in place rather than move the mesh on their own.

This will help clean up the crappy roundhouse kick animation we had in place at the end of our last tutorial.

You can find the GitHub project in the usual location if you want to play with the finished animation sets.

Additionally here are a few links to do some further reading on the items we discussed:

Thanks and see you next time.

Unreal C++ Tutorial – Player Character Series – Punch – Part 6 – Review Lesson using Kicks !

By | Development, Tutorial, Unreal | One Comment

Hey guys,

Today we are finally back with the Player Character series , picking up where we left off, as well as incorporating all the previous tutorials into this lesson.

This time we are going to do a review lesson, where we go back over all the topics we covered earlier, and use them to implement a new set of attacks in the form of kicks.


The GitHub starter project can be found here as well as the final version with all the things.

The major component that is net new to this series is the inclusion of an additional Blend Node which you can read about here.

Take a look and we will see you next time.

Unreal Engine C++ Fundamentals – UAnimNotify & UAnimNotifyState

By | Development, Tutorial, Unreal | 2 Comments

Hey guys,

Today we are going to continue exploring Unreal Engine C++ Fundamentals before we get back to our Player Character series by taking a look at Anim Notify and Anim Notify States.

You can find the GitHub project for this video in the usual location.

What is a Anim Notify ?

An Anim Notification or a UAnimNotifyis a way of assigning events to parts of our animation that will be triggered at specific times of the animation playback.
UAnimNotifiesreally only have one notification event. It either fires or it doesn’t.


Why do I care ?

Well most games have various animations and each animation may trigger different effects depending on it’s life cycle.
For example if we want to play back a noise that a weapon makes as our character slices it through the air we may want to use an UAnimNotifyto trigger this event and then we can tie that event to the playback of our wooooshing sound.
We can also use notification events to trigger special effects, events in the game, UI updates, whatever you can imagine you can tie into this execution.

Ok smart guy what about Anim Notify States ?

Anim Notify States or UAnimNotifyStateare almost identical to our Anim Notifies except for one difference and that is that Anim Notify States come with three events:

  • NotifyBegin
    • This even is fired once when the notification is first triggered.
  • NotifyTick
    • This event fires continuously every tick, during the execution of an UAnimNotifyState.
  • NotifyEnd
    • This even fires once at the end of the UAnimNotifyStateexecution.


Alright so we have these magical events, how do we code them ?

First let’s take a look at a UAnimNotify


class UE4FUNDAMENTALS03_API UPunchThrowAnimNotify : public UAnimNotify

  virtual void Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation) override;



void UPunchThrowAnimNotify::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation)
    // print method name to screen
    GEngine->AddOnScreenDebugMessage(-1, 4.5f, FColor::Purple, __FUNCTION__);

So, as you can see, by inheriting from UAnimNotifywe are able to overwrite the “Notify” method and then print some stuff to the screen.
Pretty easy.

Now let’s see what a UAnimNotifyStatelooks like


class UE4FUNDAMENTALS03_API UPunchThrowAnimNotifyState : public UAnimNotifyState

  virtual void NotifyBegin(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, float TotalDuration) override;
  virtual void NotifyTick(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, float FrameDeltaTime) override;
  virtual void NotifyEnd(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation) override;


void UPunchThrowAnimNotifyState::NotifyBegin(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, float TotalDuration)
    GEngine->AddOnScreenDebugMessage(-1, 4.5f, FColor::Yellow, __FUNCTION__);

void UPunchThrowAnimNotifyState::NotifyTick(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, float FrameDeltaTime)
    GEngine->AddOnScreenDebugMessage(-1, 4.5f, FColor::Yellow, __FUNCTION__);

void UPunchThrowAnimNotifyState::NotifyEnd(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation)
    GEngine->AddOnScreenDebugMessage(-1, 4.5f, FColor::Yellow, __FUNCTION__);

Cool ! Now show me how to tie those events into my game.

Well the majority of that is covered in the video but if you are curious this is what the events look like when you add them to the animations.

The way we added these notifications was by going to the bottom part of the animation montage labeled “Notifications”.
Then by Right Clicking we were able to pick our notifications.

This was all done from the Melee animation montage.



UAnimNotifyand UAnimNotifyStatescan be added to single animations as well as animation montages. Which gives you a lot of freedom as to where and how you want these events to be triggered.


So there we go guys, with just a few lines of code and a bit of clicking we have notifications coming out of our animations and into our game.
If you would like to learn a little bit more about these various topics, check out the following links:

Unreal Engine C++ Fundamentals – DataTables

By | Development, Tutorial, Unreal | No Comments

Hey guys,

We are going to continue exploring Unreal Engine C++ Fundamentals by taking a look at data driven development using DataTables.

As usual I have created a GitHub project which I will be going over in the video.

What is a data table ?

A DataTable is a grouping of records that all share common properties which can then be accessed by row references or row keys.

Another way of putting it it’s a collection of rows, like in a spreadsheet, that all have shared columns.

And yet another way is to say it’s a simple key value store.

Or a database.

Enough with your damn words, show me pictures !

Let’s take a look at the example below.

We have two rows, that contain the following attributes / columns:

  • Montage – a reference to a previously made animation montage.
  • Total Animations – the amount of animations we are expecting to start during an attack.
  • Description – a quick blurb about what is it we are storing here.

Great we went from games to spreadsheets ? What gives ?

Well as much as we all want to do fun stuff when it comes to game development, at the end of the day it is just software development. Most software development jobs require you to use a database of some sort at least once. There is SQL Server and Postgres and MongoDB and even Excel. All those things end up powering applications and games alike, as we all need to retrieve and store large sets of common data.

In the game dev space it’s just used for a bit more fun than in the other sectors.

What all this allows us to do is have common spots to enter data that represents a lot of “stuff” in our game and then be able to query or retrieve that data on a whim.

Let’s look at the example below.

If you had an RPG that had static definitions around experience and how much of that experience you need to reach a specific level. You could do all this by hand and add it to your class definitions but then if you want to make changes you have to stop everything, recompile, retest and try again. It would be much easier to just have a listing of those values and tweak them as needed.

Now if you have a data table, a database, a container object that you can manipulate outside of your game that will allow you to adjust to values. All of a sudden you become a wizard, as changes to those data points become trivial. Update a file, save, and re run your game.

Ok I am sold, so how do I make one ?

DataTables are essentially USTRUCTSthat derive from FTableRowBase. The inheritance from FTableRowBaseis what allows them to be brought in as DataTable definitions into Unreal Engine, without that they are just plain old structs.


To utilize DataTables you will need to ensure you are including the DataTables header in your code.

Like so: #include "Engine/DataTable.h"

Now let’s see what a DataTable looks like in action.

// Header
#include "Engine/DataTable.h"

struct FPlayerAttackMontage : public FTableRowBase

  /** montage **/
  UPROPERTY(EditAnywhere, BlueprintReadWrite)
    UAnimMontage* Montage;

  /** count of animations in montage **/
  UPROPERTY(EditAnywhere, BlueprintReadWrite)
    int32 AnimSectionCount;

  /** description **/
  UPROPERTY(EditAnywhere, BlueprintReadWrite)
    FString Description;

That was pretty simple, now what ?!

Well now you have a few options:

  • You can read data from the data table directly in C++, as well as write records.
  • You can import the data that goes into a data table from a CSV or JSON file to save you some time.
  • You can construct them on the fly and do whatever you need to do with them.

So let’s take a look at reading, as that will be the primary function.

// Header
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Animation, meta = (AllowPrivateAccess = "true"))
class UDataTable* PlayerAttackMontageData;

// Source - constructor
static ConstructorHelpers::FObjectFinder<UDataTable> PlayerAttackMontageObject(TEXT("DataTable'/Game/TUTORIAL_RESOURCES/DataTables/PlayerAttackMontage.PlayerAttackMontage'"));
if (PlayerAttackMontageObject.Succeeded())
  PlayerAttackMontageData = PlayerAttackMontageObject.Object;

// Source - calling data table
static const FString ContextString(TEXT("Player Attack Montage"));
FPlayerAttackMontage* AttackMontage = PlayerAttackMontageData->FindRow<FPlayerAttackMontage>(FName(TEXT("Punch1")), ContextString, true);
if (AttackMontage)
  // generate  number between 1 and whatever the data table contains for animation counts:
  int MontageSectionIndex = rand() % AttackMontage->AnimSectionCount + 1;

  FString MontageSection = "start_" + FString::FromInt(MontageSectionIndex);

  PlayAnimMontage(AttackMontage->Montage, 1.f, FName(*MontageSection));

Reading is easy, creation is hard !

In addition to reading we can also write to our data tables from within our game.

// define our data table struct
FPlayerAttackMontage NewAttackMontage;
NewAttackMontage.AnimSectionCount = 10;
NewAttackMontage.Montage = NULL;
NewAttackMontage.Description = "Newly added row";

// call AddRow to insert the record
PlayerAttackMontageData->AddRow(FName(TEXT("New Row")), NewAttackMontage);

Not bad, eh folks ? They are pretty easy to get used to and provide a ton of benefits when developing complex game systems.

For more details on these various topics take a look at the links below: