Ghost trails 2d is an Unreal engine plugin to allow easy creation of after image type effects, or "Ghost Trails". It is designed to be quick to set up and easy to extend for your own needs.
Enable "Ghost Trails 2D" plugin in your project.
Open your paper character blueprint.
Add a debug key of your choosing and spawn an actor of "Ghost Trail 2d Material Parameters".
Select C_EffectTimeline for the timeline curve. (you may need to check "show plugin content" from the cog icon)
Add a material to the Materials array of the notify (e.g. MI_TranslucentUnlitSpriteMaterialGreen)
Pass the "PaperFlipbookComponent" into the trail flipbook component node ("Sprite" by default on PaperCharacter).
Run your game and press the chosen debug key to spawn an afterimage.
This class is the base of the ghost trail functionality. It is intended to be used as a core setup of the poseable object and be built upon either using the provided 2 other classes or your own.
It will create the after image via a sprite component that copies the frame of the flipbook component and applies the supplied material. It will then run a timeline based on the supplied float curve (x axis is time, y axis value is used in timeline update). When the timeline completes it will then destroy the actor.
As the intent is for functionality to be applied on top of this class it provides 2 functions that can be implemented in blueprint:
Update Effect Progress - Called with the Y Axis value provided in the curve with the intention to update the effect as the timeline runs.
Effect Finished - Called on timeline completion NOTE: This currently destroys the actor so if overriding you may wish to call the parent or provide your own clean up/pooling logic.
If you simply want a sprite to be created and destroyed this class could be used as is, however it is recommended you use 1 of the other 2 included implementations or provide your own for better effects.
The effect is achieved by simply spawning the actor as detailed below:
Time Line Curve - This should be the float curve to be followed for this GhostTrail2d
Trail Materials - This is an array of materials that will be applied to the sprite, it will apply them in the same order as the material slots on the original.
Trail Flipbook Component - This is the Paper Flipbook Component that is to be copied (usually from your character).
Should Render Custom Depth - Whether to set the custom depth flag on the poseable mesh.
This class is an implementation of the Ghost Trail Base class that sets the materials up as dynamic material instances so that the parameters of the material can be during the timeline update. As such this should be used if you wish to update a material parameter directly in order to achieve your desired effect, by default this class will use the parameter of "Opacity", but can be set to what ever you desire.
This class is an implementation of the Ghost Trail Base class that sets sets primitive custom data on the sprite during the timeline update. This should be used if you wish to update primitive data on the sprite to achieve your material effects, thus avoiding the overhead of creating dynamic material instances. This provides the additional option of being able to set the index that is to be updated.
GhostTrails2d can be used with PaperZDs anim notifies but due to it being a non standard Unreal Engine plugin that functionality can not be included within this plugin for sale on Fab. However there are 2 fairly simple ways to get this functionality.
Create a blueprint based on a PaperZDAnimNotify to spawn the GhostTrail2d as detailed below.
Use the free plugin listed below to add PaperZDNotifies directly for GhostTrails2d
Firstly create a blueprint using PaperZDAnimNotify as the base class.
In the blueprint you will want to override the OnRecieveNotify function and set it up similar to the below using the correct class and promoting any variables and setting them to instance editable that you wish to set on the notify.
Then you should be able to simply add the notify to any PaperZD anim sequences you wish.
If you wish to use the already setup anim notifies for GhostTrails2d you may download the plugin with these in from the github releases here and add it to your project. The source code is also available there should you wish to just port that into your project instead.
The documentation for using these notifies is available here.