Fighting game - How to always make fighters face each other?

So what I did was take the side scroller template and turned it into a fighting game template with a some simple tweaking for instant left and right turns.

The branch in the above pic is so that once player jumps they can’t change jump mid flght.

The situation now is how to make the players always instantly snap and rotate to face each other once a threshold is crossed.

I imagine that the the “get look at rotation” will be integral to this functionality but I have not got it yet. Any ideas how to accomplish this ability for a fighting game? Thanks.

Ok, here is how I got to work. As always there is probably a ton of ways to do this in UE4, but this is how I achieved it.

As stated above I used the side scroller template, so I duplicated the side scroller player character as player 2.

You are going to want to make a really…really…big box collision to attach to the player. Name it “P2 A box”. It will be in front of the player or facing right for the fighting game.

Here is the L R S I used…


Now…duplicate the A box and rename it “P2 B box”. I changed the 8000 to -8000 so it just moved the duplicated box position to behind the player or to the left for a fighting game.


The boxes should now be back to back. Meeting in the middle of the player, the A box to the right, the B box to the left.

The video below tries to show that.

Add the following code to your second player BP…

Don’t forget to choose side scroller character (not 2) in the “Get Actor Of Class” node.

In player 1 you will not have to use the A, and B box system, instead, simply add the following code…

Don’t forget to choose side scroller character 2 in the “Get Actor Of Class” node.

The effect should be working now…demonstrated in the video below.