Download

Can you spot the difference?

215b8d7acd40fa9fe878089ea909c5a32d894933.jpeg

I have this animation setup for a character. He can run, block with a shield, and hit with a sword.
He blocks when RMB is clicked, which activates a bool on the char called “Blocking”
He strikes when LMB is clicked, which activates a bool on the char called “Striking”

The eventgraph on the anim blueprint calls both of these bools, and sets them as their equivialents on the AnimBP.

Both SwordStrike1 and ShieldDefHighKeep, are both unticked in the “loop animation” bool, along with 0.0 in “Start Position”

Now… Whenever i click RMB, he raises/lowers his shield as he should, however when i click LMB he swings the sword on the first click, and further clicks doesn’t do anything. The bools fire and setup like they should, but there is just no animation.
If i instead keep everything the same, but instead set the “looping animation” bool on SwordStrike1 to true, he swings the sword as required with a LMB click.

Any idea as too why this happens?

(I would rather like the sword swing to restart on every click, instead of a looping function, as this causes some offset problems with some delay timers.)

EDIT: When debugging, it seems thay are both left on the last frame, and doesn’t restart uopn clicking, and with the shield, i am lucky catchingit in the good position on the last frame. So it seems like they should be reset somehow. How do i do that?

From a logic stand point it should work in theory but to know whats going on as to progression we would need to see the event graph but where it could be failing is during the progression both “blocking” and “striking” could be set to to true so whats closer to the final animation could over ride what comes before it.

The flaw in the animgraph is adding a blending layer based on the idea that blocking and striking are unique actions and using animation clips instead of a montage it then becomes difficult or impossible to time the state change on the tick. A better option would be to use a blend poses by int and assigning a unique integer value to the desired action blended as a montage. The benefit is only one montage can be applied at a time, a animation notify can be added as to start and end of the montage event, and the blend state controlled by a single variable

For example you can create a integer variable “melee” and assign actions as

0= base
1=blocking
2=striking

and further:

3=leftpunch
4=rightpunch
5=leftblock
6=rightblock

Since the state can only be changed by a single variable the final pose can not be in conflict with a Boolean switch that would be difficult to change the more melee actions you add and as a montage can be added by a list in the event graph and cut your blend down to a single state change.

I tried switching to blend it with integers instead. This simplified the graph, so it became an overall improvemt. However it didnt solve the problem.
However when i created a state with “Strike” as the only animation, it worked prefectly. Ty for the input :slight_smile: