Im implementing certain Camera movements in my turn based games. I'm able to place and rotate the camera between two units that attack each other. However it will always move to the same "side". Which isn't necessarily wrong, the rotation of the camera just seems to be sharp when it's on the other side of the half plane ( as of right now it always goes on one half plane). I would like the camera to move to one side relative to the cameras position.
Essentially I just have to flip the Normal which gives me the direction where I have to place my camera:
A and B are units.
C is the current camera position
T is the target position.
center = Vector3.Lerp(attacker.transform.position, target.transform.position, 0.5f); Vector3 diff = attacker.transform.position - target.transform.position; Vector3 normal = Vector3.Normalize(diff); normal = Vector3.Cross(Vector3.up,normal); //CHECK HALF PLANE HERE normal *= -1; //Center is the target position. center -= normal * (diff.magnitude + 1.0f);