Casting variables from charBP to animBP

Hi,

I’m trying to use the data from Y and X axes from the camera input in my character BP to drive a blend space in the animBP. But I can’t figure out how to use the cast node. So far this is what I have.

charBP:

animBP:

How should I do this?

Hey @Eldok_Enn!

You’re doing it in reverse! You should cast to your character BP inside the Event Graph of your anim BP.

Here are the steps:

  • Open up the Event Graph of your Animation Blueprint
  • Right click on an empty space inside the Event Graph, and into the search bar of the menu that pops up, type in “event blueprint initialize animation”, and hit enter to place the node
  • Perform the cast on initialization using the node, then right click on the blue output pin of the Cast To node (named “As MyCharacterBP”) and on the menu that pops up, select the option to promote it into a variable (let’s say you named the variable “character”)
  • Get the Event Blueprint Update Animation node the same way we did with the previous node, then drag our character reference from the My Blueprint window on the bottom left into the Event Graph, right click on it, on the menu that pops up, select the Convert to Validated Get option, and connect it to event bp update anim
  • Now create a new float type variable in your anim BP, place the set version of it into the Event Graph, connect it to our validated get node, and as for the value, you can drag the original variable (the one from the character bp) from our character reference, and plug it into the input pin of the set type node

You can now use the float type variable that you created in the anim BP as a param for your Blend Space :blush:

Hope this helps! :innocent:

Nice it works, thank you very much!

1 Like