I am using an enemy which after an event must change its direction to the player.I am using set focal point …but it is not working…I don’t know why?
thanks in advance
I am using an enemy which after an event must change its direction to the player.I am using set focal point …but it is not working…I don’t know why?
thanks in advance
I’m struggling with this, as well. Any luck sorting it out?
You need to understand difference between Pawn and Controller. Controller is brain and Pawn is your actual model that runs in game. So you need Pawn location and not controllers.
Also Set Focus sets one time (like on Begin Play) and stops focusing by calling “Clear Focus”
Set Focal Point needs to be set every tick (or as fast as you want)
Set Focus sets FocalPoint as result, so dont use both same time
Can confirm this doesnt work in multiplayer. At least the way I’ve done it. The focal point is being set, the location of the player is correct, but the AI does not face the player. Bug?
This is a very late answer, but I just stumbled on your post, and can’t leave it unanswered.
In order for it to work in multiplayer you have to replicate pawn rotation information to other clients, AI controllers exist only on your Server, and setting focal point won’t automatically replicate this information to other client pawns.
On of the way to fix it would be to to take your resulted pitch and yaw data on the server and manually replicate it to your pawns.
hey,
Thanks for this comment.
That’s exaclty what is troubling me in a multiplayer game. The server AI would naturally set its body parts pitch along spine, but client AI would be upright all the time.
The yaw rotation is replicating thanks to Pawn.UseControllerRotationYaw=true.
The Pawn.UseControllerRotationPitch should be false for me as I do not want to rotate full character, but just spine parts.
So… the solution would be as @lab-one writes - replicate the pitch as additional variable and then use it for clients only in the Animation Blueprint instead of ControllerRotation that is not replicated by Unreal.
You are welcome.
One more little thing, since you’re mentioning spline to cover all possible cases.
If you have exactly the same spline on the client (for example object that holds the spline doesn’t marked as Server Only and exists on both, or replicated), that means client might already have the information about the desired pith in the spline itself.
In that case if you’re already synchronizing location along spline, then you can deduct required pitch from the client spline without synchronizing the pitch.
But synchronizing pitch might be perfectly fine for other reasons too.
Good luck!