I’m working on a big refactor of camera and navigation API in the engine. It is not merged yet, but you can see the in-progress work in camera-refactor branch (or see the differences from master branch).
The current API of camera has a few drawbacks that the refactor addresses:
Current camera settings (“what do you see in a viewport”) are mixed with navigation logic (“how do you use keyboard/mouse to change the camera”). They are mixed within the
TCameraclass, and this causes various headaches when setting or auto-detecting them. All games need the same camera API, but various games need wildly different navigation logic. Many games want to just “roll their own” navigation code.
This is addressed in the new branch, by splitting into
SceneManager.Navigationinstances. The mechanism to auto-detect their settings (based on scene bounding box, X3D nodes etc.) can be now easily disabled by
SceneManager.Cameramay not be created before the first rendering, which is not comfortable. It causes the need for methods like
SceneManager.Camera <> nil.
In the new branch, it’s simpler. The
nil. In contrast,
nil, and it may even remain
nilforever, unless you want to use some built-in navigation logic.
Changing projection parameters using
SceneManager.OnProjectionis not comfortable. Changing projection parameters using CGE editor was not possible.
In the new branch, you can just use
SceneManager.Camera.ProjectionXxxparameters. It’s natural both in code, and in CGE editor.
Ideally, the class
TCastle2DSceneManagershould be deprecated and later removed. It should be trivially easy to get the same effect (orthographic camera, projection API comfortable for 2D games) with the base
I want to create an easy class for 3rd-person navigation. This means that input drives some character, while camera follows this character. This was requested by Robert Daniel Murphy on Patreon.
Stay tuned for more information about this:)