Is it possible to possess a Character controlled by an AIController?

Here’s what I’m aiming to do (football type game).

  1. I’m wanting to have a wide receiver (AI Controlled Character) run a route down the field through some behavior tree stuff I set up.

  2. Once my user controlled quarterback throws a pass to him (and the AI Wide Receiver catches said pass), I want to now POSSESS that Wide Receiver.

Is it POSSIBLE to possess and AI Controlled Character?

Hi.
In unreal engine, at one time only one controller can control character.
But! There is variants. I have tips to pass this problem.
First you need pawn that will be controlled by Player and recieve inputs from the player.
For example like this one:
image
Inside Pawn you can set your inputs
(here only two of them, but it is possible to implement all of them if needed)


Then you will need to spawn that pawn instead of player. Just add pawn class into your game mode - default pawn class.
image
Also you will need from the pawn to spawn character that should be controlled. I don’t do this step bacause in my system controlled pawn is spawned instead. But you will need this step.
After character is spawned - attach your pawn to it to make them move together.
like this:

Now need to pass inputs from player controlled pawn to the character that is controlled by AI. How to do that?
Well… in the past there was only one solution of that, it is - making an interface. Let me show you one in my old project(if it’s still working…)
image
Make Blueprint Interface lake this. Then in your controlled character - implement this interface here:

and implement necessary events:

Also you should note, that you Can’t, literally can’t pass Control Rotation thru unterface to Ai character.
It’s literally impossible.


I tryed to pass it but only solution that worked is to pass rotation input thru Tick. Just make - get control rotation from controlled pawn and set actor rotation to the target character. Hope this helps.
And here is small note. Maybe right now you can pass inputs without using an interface because Epic’s made Input Subsystem plugin.
Go to Plugins - find Encanced Input there. Then enable it. Look some videos about this plugin on Youtube. Try using it to pass inputs from pawn to character. Instead of interface.

That’s all my experience. Hope it helps.

You can see small part of this system in action on here - 1.38 GB folder on MEGA
you can get two my projects for free, you need only first of them, this one - FreeFlow Combat System in Blueprints - UE Marketplace
In it you can press play and press M key to pass controls over your pawn to AI
It will do it like this:

(sorry for bad english, btw)

1 Like

Thank you for taking the time to (thoroughly) respond!

1 Like

Sure, you can just UnPossess it and possess it with your PlayerController.

1 Like

yes, you only need create a a player controller(brain), AIcontroller(Brain) and a character(Body). And use Possess node.