Cast doesn't work

Hello guys,
I’m new in UE4, and I’m having a little trouble with my movement and mouse inputs. So I’m following a tutorial and I’m having a Controller that is receiving the inputs and updating their variables, but when I use cast to get the variables in my AnimBP class they’re 0. I’ve tried printing the variables and got 0. Below you can see my code.

Thank you in advance,

Your Player Controller only exist if you start the Game. Click Play come back to this Window and in the upper toolbar you See Filter. Choose your Character there and it will show up properly.

My problem is that the AnimBP doesn’t receive my input and my character cannot move, even can’t rotate the mouse. I don’t know what’s the problem. Also, in project settings / input I’ve added the needed values, but it’s same.

You need to have an isvalid node in there to prevent that from happening.

Perhaps a silly question, but does your game use your custom player controller?

Yes, I’m using my custom gamemode with my custom player controller, character etc.

Can you explain it better? I can’t understand I’m still new in UE4?

Rotating the mouse is actually not a responsibility of the AnimBP. You need to set “Use Pawn Control Rotation” to true in your character BP’s spring arm details. And moving your character isn’t done in the AnimBP either. Link your input axis to “Add Movement Input” in your characters BP.

Take a look at this:

You need to hook the get player controller to that node, then if it is valid do the cast, also hook the get player controller to that node.

Please mark this as answered if this helped you.

I don’t have any code in my Character BP, only in the player controller and the AnimBP.

Nope, doesn’t work.

Then in your player controller, something like this should do the job:


If you want your character to orient towards movement, then go to the details tab of your character movement component and check “Orient rotation to movement”

My character is still not moving :x