I’m making a 1vs1 fighting game with a shared camera. I want to rotate the camera so the viewangle stays on the same side of the players when they rotate around, similar to this game: Let's Play Bushido Blade (PS1) Part 1 - YouTube (gameplay starts at ~3:37).
I’ve tried getting the players rotation and setting the camera actors rotation, but it doesn’t seem to rotate correctly.
Any suggestions would be greatly appreciated!
you need to get middle location between players, then make CameraLocation - MiddleLocation, normalize result and this will be direction vector. Now you can use one of MakeRot functions. For example MakeRotFromX and rotate camera with this rotator.
Hey does this same method apply if my camera is an component of an actor? I’m getting some really weird results, maybe i’m not calculating the math correctly.
Ok, so i’ve managed to get the camera rotating correctly. The only issues is now that when my players surpass a certain rotation, the camera flips to the other side of the players and the players movement is affected by it, as i am using the cameras direction for the players controls. Any idea what could be wrong?
I’m getting each actors rotation, summing them together and dividing that by 2(Similarly to how the center point is calculated in the first picture). The division is clearly causing the camera to flip, but also makes the camera actor rotate correctly otherwise. I’ve tried normalizing the value but it doesn’t seem to help.
Not sure, but its some kind of lock. Camera uses characters location to calculate rotation, and characters uses camera rotation to calculate their rotation.