CameraController
Third-person orbit camera following Blupi.
Overview
CameraController positions and orients the Urho3D camera to follow
the player character (Blupi) in third-person view.
The camera orbits around the target position at a fixed distance and preset angles.
Header: src/GalaxyEggbert/Game/Camera.hpp
Default Parameters
float yaw_ = 180.0f; // degrees — faces towards +Z by default
float pitch_ = 25.0f; // degrees below horizontal
float dist_ = 12.0f; // distance from target in world units
API
class CameraController {
public:
CameraController(Context* context, Scene* scene);
void SetTarget(Node* targetNode);
void Update(float dt);
Camera* GetCamera() const;
Node* GetCameraNode() const;
};
Update Logic
Each frame, the camera node position is computed as:
Vector3 offset = Quaternion(pitch_, yaw_, 0) * Vector3(0, 0, -dist_);
cameraNode_->SetPosition(targetPos + offset);
cameraNode_->LookAt(targetPos);
Yaw and pitch are currently fixed (not mouse-controlled).
Auto-zoom based on GameData::autoZoom adjusts dist_
in certain screen-width conditions — Needs verification.
Collision
No camera-vs-world collision avoidance is implemented in the current phase. The camera can clip through geometry.