Hi Community!
I’m working on a 2D/3D mix currently. My 2D objects consist of a quad, which is textured and rotated to always face the player. I’m using the CameraFacing.cs (original by Neil Carter, modified by Hayden Scott-Baron) script and it works so nice for SP. I use the settings Reverse Face: Yes, Axis: forward.
But when I want to go for MP, I have no idea how to handle this, because the actual sprite is rotated and obviously can’t always face both players. So what can I do?
One thing I’ve tried is, that my 2D objects consist of two quads, one showing the front and one showing the back and being rotated by 180 degrees and made a child of the first quad.
This does work for one camera. If I turn the “Always face the camera” script off and walk behind my 2D character, it shows it’s back. Wonderful! If I’m facing the 2D character from the side it is (which is no surprise) flat! So it needs to rotate with both cameras, but somewhat independent? How do I determine, that a player is in front or at the back of my sprite?
Another idea of me was, that I make a sprite sheet, showing both the front and the back. Then I determine the position of the player and either show the back of the sprite or the front (see professional image). This seems like a good idea, but I’m still facing the problem of the independent rotation. This also looks a lot like a problem to solve with atan/arctan (don’t know the proper english term) at least in the BASIC progamming language (which is the one, I’ve started with)? I could make the enemy randomly pick one of the players to face and then calculate the corresponding angle to the position of the non-picked player. Maybe something like that…
Help is greatly appreciated! Thanks in advance.