/ Work

UE4 - Blender Animation

Here is a first workflow draft to integrate several animations from Blender to Unreal Engine 4.

Tomorow I will take some references from a building to continue my actual architectural project. So today, I have some free time to make some research on animations. If I want to make an elevator I will need the following:

Things that an elevator do:

  • When you press the button in X floor
    • elevator is finishing previous action
    • elevator is going to the floor X
    • elevator is opening door
    • elevator is closing door
  • When you press Y floor button inside the elevator
    • elevator is finishing previous action
    • elevator is going to Y floor
    • elevator is opening door
    • elevator is closing door

There is different animations here that we can sort:

  • Idle
  • Opening door
  • Closing door
  • Moving to floor

These could be separate in two categories:

  • Blueprint Animated: Moving to floor
  • Imported Animation: Opening/Closig door, Idle

So I will focus only on the importing animation for now. I expect my workflow to be this way:

  • Blender: Make a 3d model of the elevator (Body + Doors)
  • Blender: Armature, rig bones
  • Blender: Animate
    • Idle
    • Open
    • Close
  • UE4: Import the FBX

Looking for a workflow

Blender - Modeling

I do not remember well how animations works on Blender, so I will start with a simple mesh with basic animation: Two cubes, one main that will not move, another one that will slide. I will put the vertice in different group and apply different material to cube 1 and 2. I also generate the UV map to avoid any warning about it in Unreal later.

01_vertexGroup

Blender - Armature

From this point I will need my bones that will move my vertices. From Object Mode I press Shift + a then Armature / Single Bone. The default position of the bone satisfy me, I select in Edit Mode the top of the bone, I extrude it (e) to have another bone with same size. I disconect it from his parent and place it to my second box position.

Then I am parenting my mesh to the armature: selecting first the static mesh, selecting the armature, ctrl + p, Armature Deform / With Automatic Weights. Now by moving each bones in Pose Mode it is also moving the right cubes.

More about bones on the WikiBooks.

03_Bones

Blender - Animation

We will need later 3 different animations but let's start with only one and check in Unreal if everything works well. I keep a 3D view on one side and open a new screen with Dope Sheet, I select the Action Editor mode. And naming my first action "Slide Action". I enter different locations keyframes and I am done. I save the data block inside. I can now export it and import it.

Unreal - Import

An issue appears: the animation scale is totaly different (and there is some warnings)

  • No Smoothing group information was found in this FBX scene
    • No need to care about it, not related to the animation
  • The following bones are missing from bind pose: Child_end
    • this could lead to our issue, let's check it later
  • Imported bone transform is different from original
    • it looks like our issue

This issue has been reported in 2015 on the Unreal Engine forums. They suggest to switch from Binary exporter to ASCII one, to avoid axis troubles I exported "Z" as top and "Y" as front. When I imported with a scale multiplied by 100 it worked; I unchecked Convert Scene and Convert Scene Unit in Miscellaneous as well.

Unreal - Blueprint

To be able to switch between different animations, we need an Animation Blueprint and an actor to control it (The actor could be a panel inside elevator for example).

In the animation blueprint, I made a new State Machine and a boolean. This boolean will let me switch between two states in my example: Idle and Slide; for the elevator we can make it this way: Entry → Idle → Open Door → Idle Open and Idle Open → Close Door → Idle.

Create-Animation-Blueprint

statemach

stateMachine

statemach-bool

making-events

When the events are ready, it is then possible to make the actor that will call the animation events.

Actor-Blueprint

늑대머리

늑대머리

R&D Software Engineer / Client Game Programmer - I am crafting video game prototypes during my spare time and if I really have too much time I take pictures and write posts for this blog.

Read More