preface

Most games use this logic for attacksCopy the code
Graph TD trigger attack judgment --> Attack judgment successful Attack judgment successful --> Play animation Play animation --> Attack complete
Of course it's a general process and there's actually a lot of variationCopy the code

It’s a little bit messy

Character animation

Understood as the movement of the model after receiving instructionsCopy the code

The little white man of UE4

UE4's own little white man has already played skeleton movement is actually a period of time the skeleton changesCopy the code

Animation blueprint

Once you bind the skeleton, you can reproduce the action, which is independent of the mesh, just a compilation, running around.Copy the code

Make an animation blueprint

You have to be able to do Blender, or basic modeling. Blender is a free modeling software, and someone took the little white man of UE4 and made a pluginCopy the code

And then you can see that all this RGB is doing is adjusting the position of the model so that it fits into the animation in BlenderCopy the code

Hierarchical operation

The IK of the little white man is layered, with each layer corresponding to common links, such as finger bending and back rotationCopy the code

Stored action

The key frames for the design action are stored here and exported to this section of the dataCopy the code

Nonlinear animation

If multiple different actions need to adjust the frame position, they can be left uncheckedCopy the code

After a day of little white people

It's better to make do than pay for it at the storeCopy the code

UE4 after import

That's the thing that's the action and then the logic of actionCopy the code

Attack logic

First a stake and then a little white manCopy the code

Attack and movement are usually designed togetherCopy the code
Graph TD Start --> click click --> Hit location Click --> Hit location --> Move location Hit pile --> Move into attack distance move into attack distance --> Execute attack judgment
This is a bit clearer to implementCopy the code

In order to implement the attack within the attack distance, the tick event is usedCopy the code

Stake Into Attack Range

Considering that the attack distance is unique to the Character, put the design in Character, and put the attack determination in CharacterCopy the code

Hit Stake

The event scheduler delegete is used to do the health change work back to the Stake for the event bindingCopy the code

Call animation blueprint after attack determination

Create a new state machine and put your own attack animation in itCopy the code

And put the attack decision in the catheterCopy the code

Back to the eventCopy the code

The operator's ref is stored first to get the result of his attackCopy the code

Attack frame front and back

I did 38 frames of this animation, and I put a notification event at 33 that the attack was overCopy the code

You can see that back in the HitStakeCopy the code

Graph TD attack ends --> enter the Stake life change command

Forward waist and optimize hand lift

In other words, the first 32 frames are controlled by oneself, which is the lifting of the hand while playing the game. What optimization lifting of the hand is to move your message notification forward a few framesCopy the code

Back waist and cancel back waist animation

The latter 34-38 frames are the rear waist, which is understood as the tail of the animation and controlled by itself. However, s stops the player's attack mechanism, which is called canceling the animation, forcing the character into Idle state, and then making the character moveCopy the code

If there is such a thing as skin optimization hand lifting

The game company sold skin to push your frame forward a few frames!Copy the code

If you open the box with a skin change the client found a lift to optimize the obvious one

SMDDX
Copy the code