Hey huxi,
ok so to get my hand on this i need to have some clarification:
You have an NPC and he has an AnimationBlueprint with the “Distance” variable.
And you want to set the variable to 1 as soon as you overlap with the collision of this NPC.
If this is correct, then you will need to do the following:
I called my NPC simply “NPC” and the AnimationBP of him “NPC_AnimBP”.
Inside of my own PlayerCharacter, i went ahead and created the overlap node just by rightclicking into the empty EventGraph and searching for it:
http://puu.sh/h8Vu7/634755b098.png
You can also do this by creating an overlap event of the capsule. Important is the next part.
Either way, drag of the “OtherActor” pin and cast it to your NPC class. Because this is the Actor we are overlapping with.
http://puu.sh/h8Vw5/56a9ba8161.png
Now we want to get a hold of the AnimBP he is using. Wie also need to cast it to our NPC_AnimBP, because this is the
specific AnimBP Class we are using and we can’t get or set the Distance without casting (Because the BaseClass doesn’t know
about this new Variable):
http://puu.sh/h8VDs/4641395c95.png
And now you can simply set the Distance variable:
http://puu.sh/h8VIM/ad3234bf5b.png
And this is all the magic you need. To sum this up: Distance is the float variable inside of the AnimBP of your NPC.
The screenshots are taken from inside the EventGraph of the PlayerCharacter.
Even if your setup differs a bit, you will need to do it somewhat like this.