Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Montage Branching Point Firing Prematurely

Hi guys,

I am having a big issue with branching points. I will describe it as best I can, but I'm not particularly certain where the problem arises. Any help would be hugely appreciated...

The Situation

My game contains a combat system. The player can click to swing a weapon, and they can only swing again once the original swing has finished. Because I have various events tied to certain branching points, and because I desired a little more control, I have derived UAnimInstance into my own subclass, UCharacterAnimator. This contains a few variables that allow me to control the various states of my characters animation, including bools that say whether or not the player is currently mid-animation, if the animation is interruptible, and various methods for playing and stopping animations. Two in particular I feel are important:

 void UCharacterAnimator::StopAnimation(UAnimMontage* animName, bool instant)
     if (animName)
         Montage_Stop(0.5f, animName);
     if (instant)
 void UCharacterAnimator::EndAnimation()
     Animating = false;
     Interruptable = true;
     AnimationMovesCharacter = false;
     CanMove = true;
     Caller = 0;
     FString animName = GetCurrentActiveMontage()->GetFullName();
     GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Magenta, "~~~ENDANIMATION~~~" + animName + " " + GetOwningActor()->GetName());

My blueprint looks like this, and is derived from this new subclass (please ignore the bottom right...):

alt text

So, when the required branch point is hit, the "End Animation" method (shared above) is fired, and all of the variables (set in the play method) are reset. So far so good.

The Problem

In this situation, I am testing what would happen if a character attempts a melee attack and is subsequently blocked. They should swing, but when blocked, the animation is stopped (StopAnimation is called) and then a "Knockback" animation is played immediately after (which will prevent them attacking until the animation is over, and prevent them moving). The problem is that the "EndAnimation" branching point for the animation is fired immediately after playing the animation, meaning that the player is free to move and attack again, despite being mid-knockback-animation.

Here is what the game prints out, thanks to the debug text, when trying this functionality:

alt text

So, going from the bottom to the top. The hit is blocked, and the animation is stopped, thus the first purple line is printed out immediately. No problem there, although it cannot seem to print the name. However, it then immediately prints out the second line, with the full animation name - even though the branch point has not been met. And then, lastly, EndAnimation is called again by the blueprint, and this time the branch point has actually been met.

So a rough stack of functions would be:

  • Player clicks to swing the weapon: PlayAnimation is called

  • It is blocked: StopAnimation is called, which itself calls EndAnimation

  • Immediately after, PlayAnimation is again called for the knockback animation

So, can anyone provide any hint into what is going wrong? I can guarantee that the branching points are in the correct places, and on the weapon swing, it gets hit just fine. I am wondering if perhaps branching points are somehow called by the Montage_Stop function?

Any and all help would be greatly appreciated, as the solution to this has really eluded me


Product Version: Not Selected
more ▼

asked Jan 06 '15 at 08:31 PM in C++ Programming

avatar image

78 8 20 24

avatar image Mesothere Jan 06 '15 at 08:37 PM

Some further info: the weapon swinging animation and the knockback both end with the same branching point "EndFullBody"

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question