Hi there. I'd like to implement an RTS camera for my project using Cinemachine. But I didn't find any about RTS cameras. I have 1 camera that follows a character when it moves. But when a character just staying, I'd like to control the camera to look around the map using mouse input. Any ideas on how to do that? Example games: XCOM; Gears Tactics;
For a basic RTS camera there is no need to use cinemachine, create an empty then have your camera be a child of that empty, move the empty rather than the camera and that will give you the RTS/Top Down style of movement you're looking for. If you rotate the empty for example then the camera will follow it and so on, you can do all sorts with this method, if you want to smooth things out, then you simply code the camera to keep track of the empty position and rotation with lerping etc. the way you would do with other smoothing techniques.
Thanks for the reply. I tried it before, but I also need to use smooth effects of Cinemachine, like zoom to the character etc. I thought that Cinemachine is more innovated and performed than a standard way of camera movement (lerping; tweeting; etc.).
You can create the empty game object as @Lethn said, but instead of adding a child camera, create a CM virtual camera with: Body = Transposer, binding mode = LockToTarget Aim = Do Nothing Follow Target = LookAt Target = the empty game object. Your move/rotate code should simply move and rotate the empty game object. The camera will follow automatically. You can adjust damping values in the camera. CM camera will also blend nicely with other CM vcams if needed.
I thought also about this way. But also thought there is more "clear" way from the "box". Anyway, thanks for the idea.
This approach works great for pan and zoom for example normal RTS top down view, I just set the cam x rotation to 90 to point it down. But what about being able to rotate the camera from looking top down, to looking forward (eg. rotate the vcam on the x axis) while still following the pan and zoom? I get that I can rotate and lerp the vcam in code, but I can't figure out if there are any follow/target settings that will do this for me, by rotating the target instead of the vcam?
The thing about cinemachine virtual camera is that you can turn one off, and another on, and the system will transition between the two. So you can just set up multiple virtual cameras as you need and swap between them, and the actual camera will transition through them depending on the easing settings of its cinemachine brain.
Panning works great but rotation isn't working. I'm testing by manually rotating the target object in playmode, and the vCam does rotate around the target, but it remains pointing down the Z axis. I of course want the camera to rotate to face the direction the target is now facing, are there other settings to make that work?