Download

CastTo animblueprint, don't know what to branch with object ?

Hello,
I start with the blueprint.
I want to stop the sound from a blueprint, to do that I need to read the value of a variable from an other animblueprint, I use castto but i don’t what to branch to the the object


Thanks

Hi @actanse
That part is tricky ,
Basically the “Cast to” is a check on an actor, that you first need to have a reference to.
Get a reference to an actor using collisions or raycast or anything … and plug in the actor in the object. see image here
https://docs.unrealengine.com/Images/Engine/Blueprints/UserGuide/BlueprintCommsUsage/BPComHowTo/3_4.webp

Examples,
1 an actor enter a trigger, firing the event on overlap. you can pin out that actor reference and ask to unreal if is a ActorLightBob using “Cast to”
2 you use a raycast https://docs.unrealengine.com/Images/Engine/Physics/Tracing/HowTo/SingleLineTraceByChannel/GHT2B_10.png
When you cast a ray and hit an actor, from the “out hit” + “Break hit result” you can get the reference to an actor.
You dont know yet what kind of actor is, could be a monster, a player or a staticmeshActor,
so you can pin the actor and use “Cast to Monster” if the cast is success you are talking with a monster type.
Otherwise from the Cast_Failed you can try to cast again to “Cast to PlayerCharacter”

hello @Est_engine thanks for your answer, but do you have an exemple with an animnotify ? because in this case I dont know what to put with the castto animblueprint ( there is no object in this anim blueprint), but my sound variable is there… thanks