x

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"

Catch Animation Event from Animation BP in C++

Here is the scenario when I got this issue:

I'm currently implementing the attack animation and hit detection for enemy actors.

At the end of an attack ends, the enemy have to do two things:

1.Set attack animation to unplayable, which can easily done in the animation BP.

2.Clean some of the member variable value in enemy class, which can be done, in my thought, in 2 ways:

    a: call clearvariables() function in animation BP, them implement this function in C++ (this is my current solution)
    b.trigger an animation end notify in animation BP, catch the event and process it in C++ enemy class

I think that the second solution is better, since I can keep it from messing animation BP graph, and keep the function call in C++ class. The question is, I have no idea how to do it. If anyone knows how to do it, or even have a better solution for it, I will appreciate your help.

Product Version: UE 4.7
Tags:
more ▼

asked Jul 11 '15 at 02:23 PM in C++ Programming

avatar image

scw000000
6 2 4 7

avatar image ZhangHongBo Mar 28 '19 at 02:59 AM

Thank your question and answer, this helps me.

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

2 answers: sort voted first

Got the answer by myself anyway. Here's the solution:

for( TArray::TIterator it =

GetMesh()->AnimScriptInstance->AnimNotifies.CreateIterator(); it; ++it )

{

  GEngine->AddOnScreenDebugMessage( -1, 15.0f, FColor::Red, (*it)->NotifyName.ToString() );

}

you can use the NofifyName attribute to do the necessary operation you want.

more ▼

answered Sep 28 '15 at 09:26 AM

avatar image

scw000000
6 2 4 7

avatar image scw000000 Sep 28 '15 at 09:33 AM

TArray::TIterator

I missed the type

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

Hello!

For fature referance if anyone would need it. I do it right now this way:

Crating a BP variable to get the notify from animation.

alt text

Create "new notify" with whatever name.

alt text

In Animation BP in event graph get the enemy and set created earlier variable to some value on notify- event name.

alt text

In Tick function check variable and do some stuff

 void MyEnemy::Tick(float deltaTime)
 {
     Super::Tick(deltaTime);
     if (bHasPickedArrow)
     {
         //code
     }
 }


more ▼

answered Aug 10 '15 at 06:32 AM

avatar image

BananaScheriff
1 1

avatar image scw000000 Aug 23 '15 at 08:22 AM

I know I can communicating between ABP and character C++ class by a variable.

But I still wanna know if I should use it, or any better solution for it.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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