UE4 mobile afterimage

UE4 mobile afterimage

The previous project used a function of moving afterimages, and the core component is the PoseableMesh component. The specific effect is as follows:
insert image description here
Next, the implementation logic is introduced.

material

The afterimage material needs special treatment:
After creating a material, the specific settings are as follows:
insert image description here
insert image description here
Editor node:
insert image description here
The Fresnel function is mainly used, and exponenth is set as a parameter for external calls.

Afterimage Actor

Afterimage is essentially an Actor. Create an actor class. This article creates a Ghost class.
insert image description here
Add the PoseableMesh component to it
insert image description here
. Click the component. The details panel of the component is set as shown in the figure:
insert image description here
mainly the skeletal mesh of the character to be filled with afterimage. Because the component gets the pose by capturing the animation.
The main logic is as follows:
insert image description here
first, create the material instance of the material created before the material, and then assign the material to the skeletal mesh of PoseableMesh.
insert image description here
Then get the owner (the reference of the player will be set as the owner when the ghost is generated), convert it to the player class, get the player's mesh, call the created copy pose from skeleton component node to capture the current player's animation pose, and the last step is to
insert image description here
set The parameters of the material, linearize the exponenth from 1 to 0, to achieve the effect of the generated afterimage slowly disappearing, through the timeline, and then destroy the actor:
insert image description here
insert image description here

player logic

The player part is mainly the Actor that generates the ghost regularly.

insert image description here
Be careful to pass your own reference to the owner.
Finally, the afterimage effect is achieved.

Supongo que te gusta

Origin blog.csdn.net/weixin_44840850/article/details/126464781
Recomendado
Clasificación