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.