Building a top-down camera for RTS
In this section, we will build a top-down camera system, commonly used in real-time strategy and multiplayer games where the camera needs to provide a wide view of the game terrain and track the movements of multiple characters or units. This type of camera has different requirements compared to a third-person-view camera:
- The camera can move forward/backward and pan left/right
- It can zoom in to focus on a specific region of the map or zoom out for a broader view of the entire map
- The camera can tilt and rotate, allowing the player to view the map from different angles
Here is the newly created TopDownCamera
camera class in TopDownCamera.h
of the Demo5RTSCam
project:
class TopDownCamera : public SceneCamera {
public:
TopDownCamera(Scene* Scene, const char* Name = nullptr, bool IsMainCamera = true);
virtual ~TopDownCamera();
void SetUp(Vector3 pos, Vector3 target, float fovY, int projType);
bool Update(float...