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:
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.
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…)
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)