The game that we are aiming to build is supposed to contain a series of cameras throughout the scene which the user needs to be able to switch between at any given point. On top of that, each camera is supposed to be able to exhibit different kinds of viewing angles for different camera modes such as Free camera, Free_chase camera, and Fixed_chase camera, etc. In order to be able to have these features, we decided to have a camera component added to the entity's component system. The camera component has access to the transform of the entity so that it can use the entity's transformation to exhibit chase cam properties for that specific entity. All the functions exhibiting the change in viewing angles of a single camera (enforced either by its entity or the user) are implemented within the camera component. The figure below shows the update loop for a single camera component.
Over here, the 'm_type' variable is simply the type of camera mode the main camera component is exhibiting. The 'GetSpace()' function is updating the class with the transformation matrix of the entity to which it is latched.
The class specifics of the camera component can be found here: https://shantanujamble.github.io/FalconGameEngineDocs/struct_camera_component.html
Another system was required to store, all the camera components of entities that are supposed to exhibit viewing angles. Each time a camera component is initialized the camera component registers itself with the camera system via the Event system in the engine. The camera receives the camera component pointer via the event system and stores it in a data structure. It also has the main camera which would be selected from this data structure. The camera system would only update the main camera every frame.
Over here the 'm_camEvents' is the pointer to CameraSystem's own event system which basically checks for incoming events every frame whereas the 'm_cameraMoveable' is a boolean indicating whether the user is able to manipulate the camera position with key inputs. The 'm_mainCam' is simply a pointer of type CameraComponent.
The class specifics of the camera system can be found here:
The outcomes are rather crude at this point as there is still a lot of features left to implement but what we do have is quite positive.
Free Chase Cam
Fixed Cam
Currently, the camera system doesn't have an interface on the game side of code with which the user is able to choose which camera to focus on at the moment but going forward that would be one of the top priorities.
Comentários