How do I go from a hit result to an AIController class?

I have verified that my hit result has hit my character, it’s giving me an instance of my character class, however, I now want to grab its AIController component so I can send it commands.

One more thing to note, my character actually has its own type of AIController class - MinionController, but I’m trying to use the MoveToLocation node which requires an AIController input.

Thanks in advance for the help.

“Get Controller” should give you the result you’re searching for.

If you want to select multiple units and do stuff with them RTS style you could check out this template:

It has a working selection box and basic AI movement and is over all pretty great :slight_smile:

So the correct way of doing this is to cast from the Hit Actor output to Pawn, then Get Controller on the pawn and cast that to an AIController.

I have noticed though that this WILL work when my characters are created with the SpawnAIFromClass node but NOT the SpawnActorFromClass node.

This makes me think there’s nothing in the data that actually binds the Character to the Behaviour Tree and the two have to be married at runtime. Is this correct?

This makes me think there’s nothing in the data that actually binds the Character to the Behaviour Tree and the two have to be married at runtime. Is this correct?

Yes. Character is basically a body, while Behavior Tree in concept belongs to the brain (an AIController with a BehaviorTreeComponent)