List of Cameras - X-Hax/SADXModdingGuide GitHub Wiki

Below you will find the current documentation on cameras used within SADX. This article is segmented into a couple of parts to help with understanding the data. If you're looking specifically for information on the camera types

  1. Structures
  2. Enums
  3. Camera Modes Explained

Structures

Camera Entry

Camera data can be found inside of the CAM binary files. These files follow the same naming scheme found with SET files. The first two digits are the stage, second two are the act, and the letter at the end is the character.

The files are formatted similarly to SET files as well. Each entry in the file is 0x40 (64) bytes. A "null" cam object is stored initially which indicates the number of cameras inside of the file. The number is stored as an Integer while the rest of the entry is empty.

The actual camera entries are formatted as follows. Each section is explained more in depth later.

Address Name Data Type Description
0x00 scMode char Camera Type
0x01 scPriority char Priority
0x02 ucAdjType char Adjustment Type
0x03 scColType char Collision Type
0x04 xColAng unsigned __int16 X Collision Angle, Only used by Cube and Plane Collision Types
0x06 yColAng unsigned __int16 Y Collision Angle, Only used by Cube and Plane Collision Types
0x08 xColPos float X Collision Position, Always Used
0x0C yColPos float Y Collision Position, Always Used
0x10 zColPos float Z Collision Position, Always Used
0x14 xColScl float X Collision Scale, Used by Cube and Plane Collision Types
0x18 yColScl float Y Collision Scale, Used by Cube and Plane Collision Types
0x1C zColScl float Z Collision Scale, Used by Cube and Sphere Collision Types
0x20 xCamAng unsigned __int16 X Camera Angle, Usage varies per Camera Mode
0x22 yCamAng unsigned __int16 Y Camera Angle, Usage varies per Camera Mode
0x24 xDirPos float X Target Position, Usage varies per Camera Mode
0x28 yDirPos float Y Target Position, Usage varies per Camera Mode
0x2C zDirPos float Z Target Position, Usage varies per Camera Mode
0x30 xCamPos float X Camera Position, Usage varies per Camera Mode
0x34 yCamPos float Y Camera Position, Usage varies per Camera Mode
0x38 zCamPos float Z Camera Position, Usage varies per Camera Mode
0x3C fDistance float Distance to Player, Usage varies per Camera Mode

Camera Parameters

Sonic Adventure takes the data from the Camera Entry and applies it to a Camera Parameter struct which is then what is used when setting up a camera. Below is documentation on the Camera Parameters and how the Entry data is applied. These Parameters will be used below to explain how the data is processed in each mode and if it comes from the parameters themselves or hard set from the Camera Mode itself. Most of this isn't major information to know as the tools and game handle most of this. This is simply for documentation purposes.

Address Name Data Type Data Source
0x00 xCamAng unsigned __int16 Taken from CameraEntry->xCamAng
0x02 yCamAng unsigned __int16 Taken from CameraEntry->yCamAng
0x04 xCamPos float Taken from CameraEntry->xCamPos
0x08 xCamPos float Taken from CameraEntry->yCamPos
0x0C xCamPos float Taken from CameraEntry->zCamPos
0x10 xDirPos float Taken from CameraEntry->xDirPos
0x14 xDirPos float Taken from CameraEntry->yDirPos
0x18 xDirPos float Taken from CameraEntry->zDirPos
0x1C fDistance float Taken from CameraEntry->fDistance
0x20 ulTimer unsigned int Timer that starts when the Camera is activated

Enums

Camera Types

There are a total of 75 cameras SADX has. That might sound like a lot, but it's due to most of the cameras having variants that change a few of the additional parameters. Additionally, only about 18 of the camera base types are used in the cam layout files. The rest either go unused or are only used in scripted sequences such as boss fights or cutscenes.

Below is every camera type listed out by ID, name, and the preset values for the level and the direct mode. Each cam name links to specific details for each base camera type. You can find more info on Camera Levels here and more info on the Direct Mode here

ID Name Level Direct Mode
0x00 CAMMD_FOLLOW CLEVEL_NORMAL CDM_TGTOFST
0x01 CAMMD_A_FOLLOW CLEVEL_AREA CDM_TGTOFST
0x02 CAMMD_C_FOLLOW CLEVEL_COMPULSION CDM_TGTOFST
0x03 CAMMD_COL_FOLLOW CLEVEL_COLLISION CDM_TGTOFST
0x04 CAMMD_KNUCKLES CLEVEL_NORMAL CDM_LOOKAT
0x05 CAMMD_A_KNUCKLES CLEVEL_AREA CDM_LOOKAT
0x06 CAMMD_C_KNUCKLES CLEVEL_COMPULSION CDM_LOOKAT
0x07 CAMMD_COL_KNUCKLES CLEVEL_COLLISION CDM_LOOKAT
0x08 CAMMD_KNUCKLES2 CLEVEL_NORMAL CDM_LOOKAT
0x09 CAMMD_A_KNUCKLES2 CLEVEL_AREA CDM_LOOKAT
0x0A CAMMD_C_KNUCKLES2 CLEVEL_COMPULSION CDM_LOOKAT
0x0B CAMMD_COL_KNUCKLES2 CLEVEL_COLLISION CDM_LOOKAT
0x0C CAMMD_MAGONOTE CLEVEL_NORMAL CDM_LOOKAT
0x0D CAMMD_A_MAGONOTE CLEVEL_AREA CDM_LOOKAT
0x0E CAMMD_C_MAGONOTE CLEVEL_COMPULSION CDM_LOOKAT
0x0F CAMMD_COL_MAGONOTE CLEVEL_COLLISION CDM_LOOKAT
0x10 CAMMD_SONIC CLEVEL_NORMAL CDM_LOOKAT
0x11 CAMMD_A_SONIC CLEVEL_AREA CDM_LOOKAT
0x12 CAMMD_C_SONIC CLEVEL_COMPULSION CDM_LOOKAT
0x13 CAMMD_COL_SONIC CLEVEL_COLLISION CDM_LOOKAT
0x14 CAMMD_ASHLAND CLEVEL_NORMAL CDM_LOOKAT
0x15 CAMMD_A_ASHLAND CLEVEL_AREA CDM_LOOKAT
0x16 CAMMD_C_ASHLAND CLEVEL_COMPULSION CDM_LOOKAT
0x17 CAMMD_ASHLAND_I CLEVEL_NORMAL CDM_LOOKAT
0x18 CAMMD_A_ASHLAND_I CLEVEL_AREA CDM_LOOKAT
0x19 CAMMD_C_ASHLAND_I CLEVEL_COMPULSION CDM_LOOKAT
0x1A CAMMD_FISHING CLEVEL_NORMAL CDM_LOOKAT
0x1B CAMMD_A_FISHING CLEVEL_AREA CDM_LOOKAT
0x1C CAMMD_FIXED CLEVEL_NORMAL CDM_LOOKAT
0x1D CAMMD_A_FIXED CLEVEL_AREA CDM_LOOKAT
0x1E CAMMD_C_FIXED CLEVEL_COMPULSION CDM_LOOKAT
0x1F CAMMD_KLAMATH CLEVEL_NORMAL CDM_LOOKAT
0x20 CAMMD_A_KLAMATH CLEVEL_AREA CDM_LOOKAT
0x21 CAMMD_C_KLAMATH CLEVEL_COMPULSION CDM_LOOKAT
0x22 CAMMD_LINE CLEVEL_NORMAL CDM_LOOKAT
0x23 CAMMD_A_LINE CLEVEL_AREA CDM_LOOKAT
0x24 CAMMD_NEWFOLLOW CLEVEL_NORMAL CDM_CAMSTATUS
0x25 CAMMD_A_NEWFOLLOW CLEVEL_AREA CDM_CAMSTATUS
0x26 CAMMD_C_NEWFOLLOW CLEVEL_COMPULSION CDM_CAMSTATUS
0x27 CAMMD_POINT CLEVEL_NORMAL CDM_LOOKAT
0x28 CAMMD_A_POINT CLEVEL_AREA CDM_LOOKAT
0x29 CAMMD_C_POINT CLEVEL_COMPULSION CDM_LOOKAT
0x2A CAMMD_SONIC_P CLEVEL_NORMAL CDM_LOOKAT
0x2B CAMMD_A_SONIC_P CLEVEL_AREA CDM_LOOKAT
0x2C CAMMD_C_SONIC_P CLEVEL_COMPULSION CDM_LOOKAT
0x2D CAMMD_ADVERTISE CLEVEL_EVENT CDM_TGTOFST
0x2E CAMMD_BACK CLEVEL_EVENT CDM_CAMSTATUS
0x2F CAMMD_BACK2 CLEVEL_EVENT CDM_LOOKAT
0x30 CAMMD_BUILDING CLEVEL_NORMAL CDM_LOOKAT
0x31 CAMMD_CART CLEVEL_NORMAL CDM_LOOKAT
0x32 CAMMD_CHAOS CLEVEL_EVENT CDM_CAMSTATUS
0x33 CAMMD_CHAOS_P CLEVEL_NORMAL CDM_CAMSTATUS
0x34 CAMMD_CHAOS_STINIT CLEVEL_NORMAL CDM_CAMSTATUS
0x35 CAMMD_CHAOS_STD CLEVEL_NORMAL CDM_CAMSTATUS
0x36 CAMMD_CHAOS_W CLEVEL_NORMAL CDM_LOOKAT
0x37 CAMMD_E101R CLEVEL_AREA CDM_LOOKAT
0x38 CAMMD_E103 CLEVEL_AREA CDM_LOOKAT
0x39 CAMMD_EGM3 CLEVEL_NORMAL CDM_LOOKAT
0x3A CAMMD_FOLLOW_G CLEVEL_NORMAL CDM_TGTOFST
0x3B CAMMD_A_FOLLOW_G CLEVEL_AREA CDM_TGTOFST
0x3C CAMMD_LR CLEVEL_EVENT CDM_LOOKAT
0x3D CAMMD_COLLI CLEVEL_COLLISION CDM_LOOKAT
0x3E CAMMD_RuinWaka1 CLEVEL_NORMAL CDM_LOOKAT
0x3F CAMMD_SNOWBOARD CLEVEL_NORMAL CDM_LOOKAT
0x40 CAMMD_SURVEY CLEVEL_COLLISION CDM_CAMSTATUS
0x41 CAMMD_TAIHO CLEVEL_NORMAL CDM_CAMSTATUS
0x42 CAMMD_TORNADE CLEVEL_NORMAL CDM_LOOKAT
0x43 CAMMD_TWO_HARES CLEVEL_NORMAL CDM_LOOKAT
0x44 CAMMD_LEAVE CLEVEL_NORMAL CDM_LOOKAT
0x45 CAMMD_AVOID CLEVEL_NORMAL CDM_LOOKAT
0x46 CAMMD_A_AVOID CLEVEL_AREA CDM_LOOKAT
0x47 CAMMD_C_AVOID CLEVEL_COMPULSION CDM_LOOKAT
0x48 CAMMD_COL_AVOID CLEVEL_COLLISION CDM_LOOKAT
0x49 CAMMD_EDITOR CLEVEL_DEBUG CDM_TGTOFST
0x4A CAMMD_GURIGURI CLEVEL_DEBUG CDM_TGTOFST
0x4B CAMMD_PATHCAM CLEVEL_EVENT CDM_CAMSTATUS
0x4C CAMMD_KOSCAM CLEVEL_COLLISION CDM_CAMSTATUS

Camera Level

This sets how the camera acts when the player intersects with the set boundaries for the camera.

ID Name Description
0x00 CLEVEL_NORMAL Standard, activates the camera when interacting with the bounds
0x01 CLEVEL_AREA Camera is only active when inside the camera bounds
0x02 CLEVEL_EVENT Non-standard, used for cameras being used for events or special cameras
0x03 CLEVEL_COMPULSION No functional difference from Area
0x04 CLEVEL_COLLISION Pushes the camera outside of the of bounds
0x05 CLEVEL_DEBUG Not used

Direct Mode

ID Name Description
0x00 CDM_NONE No calculations
0x01 CDM_TGTOFST Calculates Position from the Target, Distance, and Angle
0x02 CDM_LOOKAT Copies Position and Calculates the Angle from the Target
0x03 CDM_CAMSTATUS Directly copies the Position and Angle only

Camera Priority

The Cam Priority is how cameras interact with others when their bounding areas overlap. The camera with a higher value will be the priority when passing through its boundaries.

Camera Adjustment

The Cam Adjustment is how the camera will ease between the active camera and the next camera the player enters. Below is a list of all of the adjustment types.

Editor's Note: Descriptions will come. These are kind of hard to explain. The commonly used one tends to be the RELATIVE3

ID Name Description
0x00 CAMADJ_NONE No transition, camera will snap into the next location.
0x01 CAMADJ_NORMAL
0x02 CAMADJ_NORMAL_S
0x03 CAMADJ_SLOW
0x04 CAMADJ_SLOW_S
0x05 CAMADJ_TIME
0x06 CAMADJ_THREE1
0x07 CAMADJ_THREE1C
0x08 CAMADJ_THREE2
0x09 CAMADJ_THREE2C
0x0A CAMADJ_THREE3
0x0B CAMADJ_THREE3C
0x0C CAMADJ_THREE4
0x0D CAMADJ_THREE4C
0x0E CAMADJ_THREE5
0x0F CAMADJ_THREE5C
0x10 CAMADJ_RELATIVE1
0x11 CAMADJ_RELATIVE1C
0x12 CAMADJ_RELATIVE2
0x13 CAMADJ_RELATIVE2C
0x14 CAMADJ_RELATIVE3
0x15 CAMADJ_RELATIVE3C
0x16 CAMADJ_RELATIVE4
0x17 CAMADJ_RELATIVE4C
0x18 CAMADJ_RELATIVE5
0x19 CAMADJ_RELATIVE5C
0x1A CAMADJ_RELATIVE6C
0x1B CAMADJ_FORFREECAMERA

Camera Collision

Cameras have three types of collision they rely on to use as boundaries for the player to come into contact with for activation.

ID Name Description
0x00 CAMCOL_SPHERE Sphere, uses Collision Scale Z to set scale.
0x01 CAMCOL_PLANE Plane, uses Collision Scale X and Y to set scale.
0x02 CAMCOL_BLOCK Cube, uses Collision Scale XYZ to set scale.

Camera Modes Explained

Below is a more in-depth look at the different Camera Modes that are used in the game. The Data and Usage tables are shared with how SALVL is currently formatted. This has the potential to change in the future. As such, the below table shows which parameters are for each common name in the event things change in the future.

Common Name Parameter Name
Camera Angle X xCamAng
Camera Angle Y yCamAng
Target Position X xDirPos
Target Position Y yDirPos
Target Position X zDirPos
Camera Position X xCamPos
Camera Position Y yCamPos
Camera Position Z zCamPos
Distance fDistance

FOLLOW

  • Description: Simply follows the player. Can be rotated using the triggers. Does not rotate on its own.
  • Parameters are not used.

KNUCKLES

  • Description: Follows the player and adjusts rotation based on player movement.
  • Parameters are not used.

KNUCKLES2

  • Description: Same as KNUCKLES except it has additional angle and position calculations.
  • Paramters are not used

MAGONOTE

  • Description: Very close to the player. Attempts to calculate a little bit ahead of the player when the player moves.
  • Parameters are not used.

SONIC

  • Description: Follows the player and will zoom in and out based on player speed.
  • Additional Notes: Sets up Deadzone and Distance values to calculate the camera zoom and has modifier angles to help keep the camera smooth.
    • Min Deadzone: 20.0f
    • Max Deadzone: 90.0f
    • Min Distance: 35.0f
    • Max Distance: 60.0f
    • Center X Angle: 0xFFFFF1C8
    • Center Steady: 0x00
  • Parameters are not used.

ASHLAND

  • Description: Fixed point camera, follows the player's movement while active.
Data Usage
Camera Angle X Unused
Camera Angle Y Unused
Target Position X Unused
Target Position Y Unused
Target Position X Unused
Camera Position X Sets Camera X Position
Camera Position Y Sets Camera Y Position
Camera Position Z Sets Camera Z Position
Distance Unused

ASHLAND_I

  • Description: Just like ASHLAND except it does not check the LR flag.
Data Usage
Camera Angle X Unused
Camera Angle Y Unused
Target Position X Unused
Target Position Y Unused
Target Position X Unused
Camera Position X Sets Camera X Position
Camera Position Y Sets Camera Y Position
Camera Position Z Sets Camera Z Position
Distance Unused

FISHING

  • Description: Called by the fishing game, should not be used in normal cam files.
  • Parameters are not used.
  • Not used by the base game cam files.

FIXED

  • Description: Fixed camera position and target. No influence from the player.
Data Usage
Camera Angle X Unused
Camera Angle Y Unused
Target Position X Sets the Target Position X
Target Position Y Sets the Target Position Y
Target Position Z Sets the Target Position Z
Camera Position X Sets the Camera Position X
Camera Position Y Sets the Camera Position Y
Camera Position Z Sets the Camera Position Z
Distance Unused

KLAMATH

  • Description: Focuses on target horizontally, keeps the player in the center of the view. Checks geometry and camera collisions.
Data Usage
Camera Angle X Vertical distance override, multiplied by 0.1f
Camera Angle Y Unused
Target Position X Sets the Target Position X
Target Position Y Unused
Target Position Z Sets the Target Position Z
Camera Position X Unused
Camera Position Y Unused
Camera Position Z Unused
Distance Distance from player, multiplied by 0.5f. Except vertically if Angle X is set.

LINE

  • Description: Follows player and has a target point. Camera doesn't move vertically.
Data Usage
Camera Angle X Unused
Camera Angle Y Unused
Target Position X Sets the Target X Position
Target Position Y Unused
Target Position Z Sets the Target Z Position
Camera Position X Unused
Camera Position Y Unused
Camera Position Z Unused
Distance Unused

NEWFOLLOW

  • Description: Camera doesn't function properly. It spins at the player's location on screen.
  • Parameters are not used.
  • Not used by the base game cam files.

POINT

  • Description: Targets a point and keeps the player between the camera and the point. Checks geometry and camera collisions.
Data Usage
Camera Angle X If not 0, ignores collision with geometry
Camera Angle Y Unused
Target Position X Sets the Target X Position
Target Position Y Sets the Target Y Position
Target Position Z Sets the Target Z Position
Camera Position X Unused
Camera Position Y Unused
Camera Position Z Unused
Distance Distance from player

SONIC_P

  • Description: Same as the Sonic camera except it's customizable.
  • Additional Notes: Sets up Deadzone and Distance values to calculate the camera zoom and has modifier angles to help keep the camera smooth. See below table for how the parameters are used for the Deadzone and Distance.
Data Usage
Camera Angle X Camera Center X Angle
Camera Angle Y Camera Steady
Target Position X Maximum Deadzone
Target Position Y Minimum Distance
Target Position Z Maximum Distance
Camera Position X Unused
Camera Position Y Unused
Camera Position Z Unused
Distance Minimum Deadzone

ADVERTISE

  • Description: This camera is broken. It sits at the world origin (0,0,0) and does not rotate.
  • Parameters are not used.
  • Not used by the base game cam files.

BACK

  • Crashes the Game in normal gameplay, DO NOT USE
  • Parameters are not used.
  • Not used by the base game cam files.

BACK2

  • Crashes the Game in normal gameplay, DO NOT USE
  • Parameters are not used.
  • Not used by the base game cam files.

BUILDING

  • Description: Focuses in front of the player on the Y Axis. Observed player from "above." It's what is used when the player is normally playing in Speed Highway Act 2.
  • Parameters are not used.
  • Only used in Speed Highway 2

CART

  • Description: Only usable when inside of a cart otherwise it remains static where it spawns.
  • Parameters are not used.
  • Only used in Twinkle Park 1

CHAOS

  • Crashes the Game in normal gameplay, DO NOT USE
  • Parameters are not used.
  • Scripted Camera for Chaos Boss Fights, not for normal gameplay.

CHAOS_P

  • Crashes the Game in normal gameplay, DO NOT USE
  • Parameters are not used.
  • Scripted Camera for Chaos Boss Fights, not for normal gameplay.

CHAOS_STINIT

  • Crashes the Game in normal gameplay, DO NOT USE
  • Parameters are not used.
  • Scripted Camera for Chaos Boss Fights, not for normal gameplay.

CHAOS_STD

  • Crashes the Game in normal gameplay, DO NOT USE
  • Parameters are not used.
  • Scripted Camera for Chaos Boss Fights, not for normal gameplay.

CHAOS_W

  • Crashes the Game in normal gameplay, DO NOT USE
  • Parameters are not used.
  • Scripted Camera for Chaos Boss Fights, not for normal gameplay.

E101R

  • Crashes the Game in normal gameplay, DO NOT USE
  • Parameters are not used.
  • Scripted Camera for the E-101r Boss, not for normal gameplay.

E103

  • Crashes the Game in normal gameplay, DO NOT USE
  • Parameters are not used.
  • Scripted Camera for the E-Series Fights, not for normal gameplay.

EGM3

  • Crashes the Game in normal gameplay, DO NOT USE
  • Parameters are not used.
  • Scripted Camera for the Eggman Bosses, not for normal gameplay.

FOLLOW_G

  • Description: Functions almost identically to the normal Follow cam.
  • Parameters are not used.
  • Not used by the base game cam files.

LR

  • Description: Functions similarly to Follow except it will respect level geometry and collision. It will get stuck in walls and sometimes snap into position if the player moves away too quickly.
  • Parameters are not used.
  • Not used by the base game cam files.

COLLI

  • Description: This is used only for helping prevent the camera from phasing into level geometry. It acts as collision that only the camera will react to.

RuinWaka1

  • Description: Used in the waterfall section of Lost World. Not intended for use outside of this level.
  • Parameters are not used.
  • Not used by the base game cam files.

SNOWBOARD

  • Description: Follows very close to the player and reacts quickly to any movement the player makes. You can see it in action in the snowboarding levels when the camera is behind the player.
  • Parameters are not used.
  • Only used in Icecap 3 and Sandboarding

SURVEY

  • Description: Top down camera that follows the player.
  • Parameters are not used.

TAIHO

  • Description: First person camera. Not intended to use in the set file, can either lock the camera or send it off into space.
  • Parameters are not used.
  • Not used by the base game cam files.

TORNADE

  • Description: Rotates to follow the player while keeping the player mostly in line with the camera. Target acts like a fulcrum for the camera to pivot with. Does not work well if the player goes above or is below the Y Target position as the camera will move in the opposite direction.
  • Only used in Windy Valley 2
Data Usage
Camera Angle X Unused
Camera Angle Y Unused
Target Position X Sets the Target X Position
Target Position Y Sets the Target Y Position
Target Position Z Sets the Target Z Position
Camera Position X Unused
Camera Position Y Added to the player position to set the camera's Y position
Camera Position Z Unused
Distance Sets a modifier for calculating distance between the Camera and Target

TWO_HARES

  • Description: This camera is non-functional.
  • Parameters are not used.
  • Not used by the base game cam files.

LEAVE

  • Description: This camera is non-functional.
  • Parameters are not used.
  • Not used by the base game cam files.

AVOID

  • Description: Change the Camera's mode based on the avoid flag currently set. Examples of this can be found in Casinopolis being used for doorways.
  • Parameters are not used.
  • Not used by the base game cam files.

EDITOR

  • Description: This originally would have been used for editing the camera's data, but the functionality for it was stripped out. It crashes the game now.
  • Parameters are not used.
  • Not used by the base game cam files.

GURIGURI

  • Description: Acts like a first person camera, not intended for use by CAM files.
  • Parameters are not used.
  • Not used by the base game cam files.

PATHCAM

  • Description: Follows a path if available, not intended for use by CAM files.
  • Parameters are not used.
  • Not used by the base game cam files.

KOSCAM

  • Description: Functions just like Survey cams.
  • Parameters are not used.
  • Not used by the base game cam files.