Adding Basic Shooting to Unreal Characters

Introduction

Creating an animation cycle for shooting in Adobe After Effects into Unreal Engine.

(Referencing recorded workshop).

The goal of this animation is to make it sudden and highly reactive. The character I initially created is not able to shoot, so I am going to be documenting and showing my understanding of the workshop Lee created to learn more about Unreal Engine and After Effects.

In Adobe After Effects, each key frame we can scale the shoot symbol or effect differently to give the illusion of a charging up ability etc:

As the character’s hands move up and forward the symbol increases in opacity and gets scaled bigger for each key frame:

Navigate to Composition > Add to Render Queue (shortcut Ctrl + M).

Adjust output module settings as above ^^^ on the ‘ninja_energyblast animation.

Open Unreal Engine, Lee imported a 32×32 sprite symbol for this attack into Unreal from Photoshop.

Convert to a sprite by right clicking > convert actions > create sprite. Create a new folder in the content browser (dashboard) dedicated to the attack animation.

Select each frame and open them into Unreal Engine content browser.

Select all frames > Sprite actions > create sprite. Right click and ‘create flipbook’. This will provide an animation loop for the attack. Edit fps to 45 and save progress. Assign a key bind to the attack animation.

Navigate to Edit > Project Settings > Input > Action Mappings > add new action ‘Shoot’ assign key (beneath) C (For example).

Open Editor > Right click ‘Input Shoot’. Create a new variable on the left hand side called is_shooting. Click and drag this variable into the editor tab and link ‘Pressed’ to ‘Set is_shooting’.

Link ‘released’ to ‘Set is_shooting’ false. (unticked box).

Transfer this into the animation handler above. Duplicate using Ctrl + W.

Link ‘Return Value’ to ‘False’. Link above ‘Return Value’ to ‘New Flipbook’:

Drag in ‘is_shooting’ variable, link to ‘index’ active an action for the true statement i.e. ‘energyblast flipbook’.

Into content browser, create ‘Blueprint Class’ > Actor, rename ‘bullet’. Add a new component called ‘PaperSprite’

Fill this in on the right ^^^

Add a new component:

In Unreal Engine, this projectile movement component has a lot of properties that other software’s don’t have. These are useful for this occasion, to help make our projectile behave how we intend it to.

Set ‘Projectile Gravity Scale’ to 0.

Back in character editor blueprint, add component ‘arrow’. Position arrow just ahead of character.

New component: ‘spawn actor from class’.

Link GetWorldTransform Return Value to ‘Spawn Transform’. The bullet needs a set axis to spawn at.

When the bullet is active, there is nothing in the game to destroy or remove the bullet from the game. This can cause a lot of problems if each bullet does not despawn. We can change this in the blueprint editor.

We can set a duration (2 seconds). Link this to ‘Destroy Actor’.

This means after the bullet is spawned, it will delete itself after 2 seconds.

Leave a comment