Building a third-person follow-up camera
It’s time for us to step forward to try implementing our own camera system for the needs of our game. Knight itself has built-in support for a third-person camera. However, it’s very basic and far from the usual third-person camera you will have seen in many games.
Let’s build a new third-person-view camera that supports the following behavior:
- It follows behind the main character (or any assigned
SceneActor
in Knight). - When the main character moves, it will automatically follow the movement and change of orientation of the main character.
- The player can have control over the camera angle both horizontally and vertically.
- The player can zoom the distance between the camera and the followed
SceneActor.
All camera types in Knight, such as PerspectiveCamera
and OrthogonalCamera
, inherit from the base SceneCamera
class. This class encapsulates the Camera3D
class provided by the underlying...