Zelda 64: Collision Format
Note: All offsets include the bank in their high byte (xxaaaaaa, x=bank a=addr)
bbbbcccc ddddeeee ffffgggg vvvv0000 aaaaaaaa pppp0000 llllllll tttttttt xxxxxxxx wwww0000 mmmmmmmm
|Variable||desc||Address relative to start of collision header|
|b||Absolute minimum along the x-axis for collision vertices||0x0|
|c||Absolute minimum along the y-axis for collision vertices||0x2|
|d||Absolute minimum along the z-axis for collision vertices||0x4|
|e||Absolute maximum along the x-axis for collision vertices||0x6|
|f||Absolute maximum along the y-axis for collision vertices||0x8|
|g||Absolute maximum along the z-axis for collision vertices||0xA|
|v||Number of vertices to load||0xC|
|a||Offset of vertex array||0x10|
|p||Number of polygons to load||0x14|
|l||Offset of polygon array||0x18|
|t||Offset of polygon type definitions||0x1C|
|x||Offset of camera data*||0x20|
|w||Number of water boxes*||0x24|
|m||offset of water boxes*||0x28|
* = optional, set to 0 if it's not needed.
xxxxyyyy zzzz (repeats for each vertex)
x = Position along x-axis
y = Position along y-axis
z = Position along z-axis
ttttaaaa bbbbcccc xxxxyyyy zzzzpppp (repeats for each polygon)
t = Polygon type
a = First vertex
b = Second vertex
c = Third vertex
x = Normal's x-direction (7FFF being 1.0)
y = Normal's y-direction (7FFF being 1.0)
z = Normal's z-direction (7FFF being 1.0)
p = Collision plane's distance from origin (unit vector normal's (a,b,c) => ax + by + cz + d = 0, (x,y,z) is point from polygon, d is distance from origin)
See collision normals for a code snippet that preforms normal calculation.
aabbbxcc #w#hkels (repeats for each polygon type)
a = Object set switcher, maybe? Or instantaneous exit?
Bit 0: Nothing by itself?
Bit 1: Nothing by itself?
Bit 2: Nothing by itself?; 2 + 3 trigger exit immediately (Link stops walking)
Bit 3: Nothing by itself?; 2 + 3 trigger exit immediately (Link stops walking)
Bit 4 through 7 define the object set/exit number, it appears, where illegal values result in nothing happening (game continues as normal).
b = Special Effect Flags
Bit 0: Climbable; 0 + 2 makes Child Link enter crawling mode (only works in center of polygon; can be glitchy if done improperly)
Bit 1: Prevents 0 from working (sometimes climbable; may produce different noise; if so, then 1 + 2 + 3 enters climb-down mode); 1 + 2 enters climb- down mode (used on ladders so Link positions himself properly when approaching from the other side)
Bit 2: Prevents 0 from working; 0 + 1 + 2 makes Link able to grab the surface
Bit 3: Nothing by itself; part of climbable/grabbable/crawlable combos above
Bit 4: Nothing?
Bit 5: Nothing?
Bit 6: Prevents 7 from working?
Bit 7: Jabu-Jabu reaction if struck
Bit 8: Out of Bounds (Link screams, level restarts)
Bit 9: Damages Link (can be slowed by the Goron Tunic)
Bit 10: Nothing?
Bit 11: Warp Transition (must be paired with exit number, otherwise crashes)
x = Exit trigger (set it to the exit number as loaded in the scene; values over the defined amount will crash the game); 0 disables trigger
c = Camera view angle
0 Default distance and behavior (same as 5, actually)
1 Extremely high birds-eye view
3 Camera follows Link at a close distance
4: Camera follows Link further away
5: Camera stays at a moderate distance away from Link (less than 4, more than 3)
6+: Similar to 5, but at a slightly higher angle
w = Special effects (for walls only)
Bit 1: Damages Link
Bit 2: Nothing?
Bit 3: Nothing?
Bit 4: Nothing?
h = Hookshot
Bit 1: Nothing?
Bit 2: Nothing?
Bit 3: Hookshotable
Bit 4: Nothing?
k = Echo (overrides map)
0: Use map value
1-F: Echo ranges
e = Ambient lighting/color/fog effect (only works if fog or environment fog is enabled)
1: Fog becomes turquoise and intensifies to max; can trigger overflow which trips the z-buffer
2: Fog disappears, z-buffering fails and actors get a green tint
3: Fog disappears, z-buffering fails and actors go black
4: Fog becomes black and intensifies to max; can trigger overflow which trips the z-buffer; blue sometimes seeps in
5: Fog fades almost immediately to black; z-buffering might fail; actors are completely black
6: Everything goes black except collision polygons...?
7: Everything goes black, but graphics are rendered properly
8-F are the same as 0-7.
l = Terrain type (note: the hues only appear if fog or environment fog is enabled)
1: High angle (Link immediately begins to slide)
4: Ambient light dims, reddish hue?
5: Ambient light dims, reddish hue, Link begins to slide
6: Ambient light dims, reddish hue
7: Ambient light dims, reddish hue
8: Ambient light dims, blackish
9: Ambient light dims, blackish, Link begins to slide
A: Ambient light dims, blackish
B: Ambient light dims, blackish
C: Ambient light dims slightly with a bit of red
D: Ambient light dims slightly with a bit of red, Link begins to slide
E: Ambient light dims slightly with a bit of red
F: Ambient light dims slightly with a bit of red
s = Sound effect/ground type
3: Wet stone
4: Shallow water
5: Not-as-shallow water (lower-pitched sound)
9: Wooden plank
A: Packed earth/wood
D: Loose earth
xxxx yyyy zzzzzzzz
x = Unknown
y = Unknown
z = Offset of skybox camera position data.
Skybox Camera Position
xxxx yyyy zzzz aaaa bbbb cccc dddd FFFFFFFF
x = x coordinate
y = y coordinate
z = z coordinate
a = x rotation
b = y rotation
c = z rotation
d = Unknown. (zoom?)
xxxxyyyy zzzzssss rrrr0000 0000qqqq (repeats for each water box)
Note: water is bottomless
Note2: water actors may take over some of the properties described here, such as the level of the top surface.
x = x minimum coordinite for water
y = top surface of water's height.
z = z minimum coordinite for water
s = x size of water
r = z size of water
q = water properties(camera effects?):
0100 = "normal water" I reccomend this variable
0102 = seems to be the same as 0100
0105 = Camera flys off and goes to a random spot?
MNGoldenEagle/JSA for mostly everything. Water was figured out by spinout. JSA has figured out some of the camera data, but the documentation has been lost AFAIK. However, some documentation on camera data has been released by DeathBasket.