Casting to enemy character BP from AnimBP: Struggling to get Speed variable form EnemyCharacterBP to AnimBP. What am I doing wrong?

I know I’m doing something silly here but I am trying to get the speed variable from the enemy character BP to the enemy character’s animation blueprint, which then sets a new speed variable (SpeedAnim) so that I can switch between idle and run animations using the enemy character’s speed variable.

As I’m sure you’ve guessed the ‘cast to BallPeopleBP’ (don’t ask) is failing every time. I’m fairly certain the object on the cast is wrong but I’m not sure what to put.

I’ve checked every tutorial I can find and I’m still struggling with the answer.

Any help is greatly appreciated!

Check this:

305961-1.jpg

(from [https://i.ytimg.com/vi/0MFx1B0QpoM/maxresdefault.jpg][2])

Thanks for the reply pal!

Just tried this and it didn’t work. I added a print string on ‘Not Valid’ which was printing to the screen throughout play. Which means the object ‘Pawn Owner’ does not exist right? So that means the pawn has no owner?

I’m not sure what that means really, or what the solution is here. Any further ideas?

Go to your character, select the mesh component and set your animation BP:

AI controller class is still set, I’m spawning in editor and the settings are exactly as shown in your screenshot.

I just can’t think what could possibly conflict for the AI controller once the AnimBP is set.

Adding the AnimBP to the skeletal mesh did the trick! The character is now playing idle instead of T-Posing, however, now that the AnimBP is added, the Ai controller no longer functions. Before they were following the player around in a T-Pose, now they are standing still. Interestingly, the cast now works just fine, showing me a 0 for speed instead of a failed cast.

Can you think of a reason why adding the AnimBP to the skeletal mesh would cause the AI behaviour to suddenly stop working?

Is the AI controller class still set in the enemy character?

Are you spawning the enemy or just placing it in the editor?

What are the settings of your enemy character:

306048-1.jpg

Here’s the AI controller and Behaviour tree. I am having some issues with it (the ai isn’t patrolling, only going straight for the character or standing still) so I know the code isn’t perfect, but regardless still doesn’t make sense why the AnimBP would be stopping this :confused:

Before even considering that something was broken in the BT and wasting time trying to find the problem with it, we must first check if the AI can make simple movements.

So, to verify that the enemy character can move or not, in the AI controller, disconnect the Run Behaviour Tree and use a simple AI Move To to the player character.

Edit: also, what happens if you remove the animation BP from the character. Does it moves?

How are you moving your enemy character?

Yes, if I remove the animation BP the character is able to move. I’ll give the first suggestion a try, though I’m not sure it will help as the enemy character is able to move, so long as it is not animated.

If the character can move when the animation BP is removed, it must be something to do with the Anim BP right? Or a conflict between that and the controller?