How to cast a animation blueprint to a blueprint actor

So I have a basic weapon actor that holds the skeletal mesh and a weapon component that holds functions to spawn bullets and bullet speed etc.

I have an AnimBP that holds animation for the weapon that I have and Need to cast it to the actor blueprint in order to get the animations I need.

I have tried to cast it and to reference the actor bp in the anim bp and cant get it to work

HELP!

I also am stuck right here.

Your weapon is a skeletal mesh right? If so, in your weapon blueprint select the skeletal mesh component, then in the details panel under “Animation” make sure it’s set to use an animation blueprint, then select the blueprint you’ve created for it.

As long as your skeletal mesh is referencing the anim blueprint, you can then go into the anim blueprints event graph under the “Event Blueprint Update Animation” and right click in an empty space and use the “Get Owning Actor” function. Plug that into a “Cast To” (Whatever your class is). You can then pull off from the resulting cast and access all the variables you have stored in there.

Get the variables you want and set your anim blueprints variables to whatever value the weapon currently has.

Good luck!

2 Likes

Thank you. This worked for me!!!

you can allso access the animation blueprint from the controller by. getpawn- > get mesh → get anim instance → cast to anim bp → save it as a variable. And if you want to play a single animation this might be more accessable, since you can simply make a custom event in the animBp and fire that event from the controller. For example, fire one bullet, or reload.

The “Get Owning Actor” works like a charm for me, thank you so much!!

It’s old but it still works even in ue5 thanks