- Camera file
- ==========================
- Header (0x80 bytes)
- ==========================
- dword camera_num; //tells the game how many cameras to load
- Array(0x3C) Padding; // filler until the first camera
- cam(0x40) default info // usually a type 00 cam, defines some default parameters. Normal camera data doesn't start until after this
- ==========================
- camera structure (0x40 bytes)
- ==========================
- Byte Camera Type; // Type of camera (I'm guessing this is actually bitflags)
- Byte unknown; // frequently unused, could be part of the camera type variable
- Byte pan_speed; // number of frames it takes for a camera to complete it's transition. 1 frame = 33 ms (1b creates strange behavior! Lots of camera 'snapping' around)
- Byte priority; // 0 doesn't activate, 2 is used for respawn cams. 1 does something else. This might be trigger method, actually. 2 meaning 'triggered by sonic'
- short unknown; (possibly x_rot or z_rot)
- short y_rot;
- float position[3]; // x,y,z location of box center
- float scale[3]; // If you make a 2 x 2 x 2 cube and use these values as scale, you should have an accurate volume representation
- int Unknown; // is usually zero. Sometimes it hits values like 0x20 0x40 or 0x60. In the default camera settings it can be totally different, looking
- float point1[3];
- float point2[3];
- float variable;
- ==========================
- Camera Types
- ==========================
- 14 = fixed camera, locking (keeps focus until overwritten)
- point1 appears unused
- point2 is camera location
- variable is field of view
- 15 = fixed camera, free (releases when you leave it)
- point1 appears unused
- point2 is camera location
- variable is field of view
- 18 seems to be another type of fixed camera
- 1F is also a locking orbital camera
- Currently indistinguishable from 27, aside from that it doesn't need
- a priority in most cases
- 20 - seems to be a 'double orbital cam' (locking)
- point 1 is orbit 1
- point 2 is orbit 2
- no idea on how they link/pick from eachother yet
- variable is distance
- 27 = orbital camera, locking (keeps focus until overwritten)
- point1 is orbit center
- point2 appears unused
- either sphere or cube collider
- last variable is camera distance
- 23 - orbital camera, temporary (releases when you leave it)
- point1 is orbit center
- point2 appears unused
- last variable is camera distance
- 04 - free cam, unlocks the focus point
- 42 - Windy valley orbital camera (keeps focus until overwritten)
- dimensions 1 and 2 function like normal, dimension 3 needs to be huge to work.
- point1 is camera focal point
- point 2 is is for setting the view angle. It either uses this as part of an angular math function, or it's trying to keep that point onscreen at all times. I can't tell
- last variable is camera distance. Small distances will occlude player if necessary.
- 28 - seems to work with no priority (00) set? Check this.
- 28 - Emerald coast, lower deck island unlock, free-follow cam
- NotUsed value is 80!
- PanSpeed is 17
- Not sure what points A and B do, although point B is above box, point A is below it
- priority is 2
- unknown 1 is 5
- variable is probably distance
- Need to try: 3d, 1d, 0b, 07, 16, and 0f
- Type bitwise comparisons:
- 00100011 (0x23) - unlock orbit camera? spherical or cube collider (definitely uniformly scaled though)
- 00100111 (0x27) - locked spherical or cube collider (uniformly scaled) (orbital, point A)
- 00011111 (0x1F) - locking orbit camera
- 00010100 (0x14) - locked fix camera (uses point B)
- 00010101 (0x15) - unlocked fix camera
- 00000100 (0x04) - unlock, apply free cam
- 00111101 (dec 61) - Unlock, spherical or cube collider (uniformly scaled) (fix cam point B) (L/R rotations are also disabled)
- 00011111 (dec 31) - Locking, 3 scale rectangular collider. Pan speed scales to character on-ground speed. Sonic is kept near the bottom of the frame
- 01000010 (0x42) - WV orbital locking camera
- 00001000 (0x08) - Emerald Coast unlocking orbit cam, outer
- 01000000 (dec 28) - strange emerald coast follow cam, inner
- There is probably a flag inside of this bitarray that enables/disables cameras colliding with the world
- Another analyzed behavior that isn't yet understood on a technical level is colliders that only activate when the player touches the ground
- At least one flag inside of this bitarray tells the camera zone to handle the collider volume in a nonstandard way. I've found one camera zone in Emerald Coast that *has* to be using either a cube or a spherical collider. I'm almost 100% certain that the only 'scale' value being used for scale is the Z value (starting to lean more towards X value now that I've looked at some other colliders). We can test the difference between sphere and cube by:
- - first finding the flag in question, and finding what the 'default' rectangle state is.
- - set the collider to 'cube/sphere' mode
- - rotate the collider 45 degrees
- - seeing if we can get within a spherical radius without it moving to the new position. If you can, that means it's a cube. If not, it's a sphere
- flag #3 might be non-rectangular collider
- flag #6 might be locked (possibly contradicted by 0x15, as well as 0x42)