The camera system is built around a director–operator separation.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/SMGCommunity/Petari/llms.txt
Use this file to discover all available pages before exploring further.
CameraDirector is the singleton that owns the active camera stack and drives the view matrix each frame. It does not compute camera positions itself; instead it delegates to whichever CameraMan is currently on top of the stack. Each CameraMan owns a concrete Camera subclass that implements the actual position-and-target calculation. A paired CamTranslator* class interprets BCSV parameter chunks from stage files and feeds them into the matching camera object, keeping data loading completely decoupled from the camera logic.
CameraDirector
CameraDirector is a NameObj singleton (retrieved via MR::getCameraDirector()). It maintains a stack of up to eight CameraMan pointers and calls the top-most one every frame.
CameraMan
CameraMan is the base class for the four operator variants (Game, Event, Pause, Subjective). It owns a CameraPoseParam and forwards calc() to the concrete Camera held by its subclass.
Camera base class
All concrete cameras derive fromCamera. The key virtual method is calc(), which writes a new pose into mPoseParam and returns the target object that influenced the result.
Camera type families
Follow cameras
Follow cameras track the player from behind and allow the player to rotate the camera left or right.CameraFollow
Standard over-the-shoulder follow camera. Supports optional orbit-left/orbit-right and automatic height adjustment.
CameraRailFollow
Follow camera whose eye position is constrained to a designer-placed rail path. Used in tube-like corridors and narrow passages.
CameraRaceFollow
Follow camera variant tuned for racing sequences with a wider field of view and faster catch-up speed.
CameraWaterFollow
Follow camera used when the player is swimming, with adjustments for the underwater view angle.
Fixed cameras
Fixed cameras lock either the eye position, the target position, or both, and do not allow player rotation.| Class | Japanese name | Behaviour |
|---|---|---|
CameraFix | 完全固定カメラ | Fully fixed eye and target |
CameraFixedPoint | 定点カメラ | Fixed eye, tracks player as target |
CameraFixedThere | その場定点カメラ | Fixed relative to where the player stood when the camera activated |
Planet-specific cameras
These cameras are designed for specific stage geometry types. Each one pairs with a matchingCamTranslator* class.
CameraWaterPlanet — water-sphere stages
CameraWaterPlanet — water-sphere stages
Used in water-planet stages. Maintains axis offsets
mAxisX and mAxisY and a configurable mAngleA to keep the camera outside the water volume.CameraCubePlanet — cube-shaped stages
CameraCubePlanet — cube-shaped stages
Handles the sharp 90-degree gravity transitions of cube planets. Stores
mDist, mAngleA, and mAngleB to control the orbit arc.CameraMedianPlanet / CameraMedianTower
CameraMedianPlanet / CameraMedianTower
Cameras for stages with a central median plane (e.g., toroidal or tower-shaped levels).
CameraInwardSphere / CameraInnerCylinder
CameraInwardSphere / CameraInnerCylinder
Used when the player walks on the inside of a sphere or cylinder. The camera faces inward rather than outward.
Boss cameras
CameraTripodBoss — Tripod Boss arena
CameraTripodBoss — Tripod Boss arena
Extends
CameraTower with an extra upZ field that adjusts the up vector to handle the three-legged boss’s arena layout.CameraWaterPlanetBoss
CameraWaterPlanetBoss
Variant of
CameraWaterPlanet tuned for the water-planet boss encounter.CameraFooFighter / CameraFooFighterPlanet
CameraFooFighter / CameraFooFighterPlanet
Camera modes for the saucer (Foo Fighter) enemy boss segments.
The CamTranslator pattern
Every concreteCamera subclass has a matching CamTranslator* class that implements CamTranslatorBase. The translator is responsible for reading a CameraParamChunk loaded from a stage BCSV file and calling the appropriate setParam method on its camera.
CamTranslatorFix, CamTranslatorRailFollow, CamTranslatorWaterPlanet, CamTranslatorTripodBoss, and so on for every camera type in the game.