3D Fighting Game Camera, Prevent Flip when players switch sides?

I need something like the camera in Tekken. I have the movement of the camera working in every way but this. Any ideas on how to keep the camera on the same side of the characters, so it doesn’t flip around when they switch places?

Hi ,

If your camera is in your player character blueprint, make sure that it is not using the player’s rotation. I would recommend, however, making the camera it’s own blueprint that only moves when the players get X distance apart, but otherwise does not have it’s movement dependent upon the players. This would prevent the flipping you are describing.

Thanks for the reply, but it’s not exactly what I’m having trouble with. I have that working so the camera stays in the middle of the two characters, and moves away or gets closer depending on how far they are from each other in X and Y.

It was working fine for a 2D style game like Street Fighter, because I can just put another dummy in the middle, and offset it’s location to the side I want to look from. It’s different for a 3D fighter like Tekken, where the characters are able to move side to side, and circle around each other.

My cam is a separate BluePrint btw.

To add that side step tracking, I have the dummy between the characters, using a look at node, to stay in line with the two characters, and offset the camera location dummy to the right vector of that one.

It works great as long as they don’t switch places. When they circle each other while walking, the middle dummy can rotate with them, which is what I need for that.

If one jumps over the other, the look at target changes direction and the camera flips real quick to the other side, which is the problem.

A way to explain what I need is to put an imaginary line between the two characters, that rotates to match their position and that lets them pass through each other, so they can switch places without spinning the line 180*.

I was thinking, that maybe the look at node could switch targets on a cross over, or maybe I can circle around the characters using a position constraint, instead of look at, but it’s not working yet. I’m still searching for a way to do this.

Hi ,

You can probably try an if check for the x values of the player’s location. If player A has an x location < player Y, the camera should be in position 1. If Y is < X the camera should be in position 2. If you do this you can dictate where the camera stays based on the location of the players. If one player jumps over the other, for instance, you can go “ok now this guy is on the left side of the screen, don’t swing the camera to compensate”.

After a lot of messing around, I found that “project” the local position of the characters using a Hud blueprint, gave me the result I was looking for. I can’t seem to break the alignment now, no matter how I move around the characters, so this may actually be it.

I have a bool in the Level BP, that changes depending on which character is further to the right in X actual screen space. That bool changes the rotation of a dummy between the characters that the camera is linked to.

Distance of the camera changes with the vector length between the characters.

The camera rotation for the flip counter is the same rotation as the default, but -180 for the yaw.

The convert world space to screen space in the level BP was confusing me, because it was giving me these numbers, that didn’t seem to match the screen.

Hi, I have a similar issue as yours but I can’t get my head to understand exactly the solution you have put in place, could you share some BP screenshots?