Types
collide-cache: basicsource
Fields
type: type
num-tris: int32
num-tris-u32: uint32
num-prims: int32
num-prims-u32: uint32
ignore-mask: pat-surface
ignore-processes: process
collide-box: bounding-box
collide-box4w: bounding-box4w
collide-with: collide-spec
unused: uint32
prims: collide-cache-prim
tris: collide-cache-tri
Methods
debug-draw(obj: collide-cache) => nonesource
fill-and-probe-using-line-sphere(obj: collide-cache, arg0: collide-query) => floatsource
fill-and-probe-using-spheres(obj: collide-cache, arg0: collide-query) => symbolsource
fill-using-bounding-box(obj: collide-cache, arg0: collide-query) => nonesource
fill-using-line-sphere(obj: collide-cache, arg0: collide-query) => nonesource
fill-using-spheres(obj: collide-cache, arg0: collide-query) => nonesource
reset(obj: collide-cache) => nonesource
probe-using-line-sphere(obj: collide-cache, arg0: collide-query) => floatsource
probe-using-spheres: unknown
fill-from-bg(obj: collide-cache, arg0: function, arg1: function, arg2: collide-query) => nonesource
fill-from-fg-boxes(obj: collide-cache) => nonesource
fill-from-fg-line-sphere(obj: collide-cache, arg0: collide-query) => nonesource
fill-from-water(obj: collide-cache, arg0: water-control) => nonesource
collide-cache-method-22: unknown
collide-cache-method-23: unknown
collide-cache-method-24: unknown
collide-cache-method-25: unknown
collide-cache-prim: structuresource
Fields
prim-core: collide-prim-core
extra-quad: uint8
ccache: collide-cache
prim: collide-shape-prim
first-tri: uint16
num-tris: uint16
unused: uint8
world-sphere: vector
collide-as: collide-spec
action: collide-action
prim-type: prim-type
Methods
resolve-moving-sphere-tri: unknown
resolve-moving-sphere-sphere: unknown
collide-cache-tri: structuresource
Fields
vertex: vector
extra-quad: uint8
pat: pat-surface
collide-ptr: basic
prim-index: uint16
user16: uint16
user32: uint32
clear-flags: uint128
collide-list: structuresource
collide-list-item: structuresource
collide-puss-sphere: structuresource
collide-puss-work: structuresource
Fields
closest-pt: vector
tri-normal: vector
tri-bbox4w: bounding-box4w
spheres-bbox4w: bounding-box4w
spheres: collide-puss-sphere
Methods
collide-puss-work-method-9: unknown
collide-puss-work-method-10: unknown
Types
collide-puls-work: structuresource
lsmi-work: structuresource
Types
col-rend-filter: structuresource
Types
collide-edge-edge: structuresource
Fields
ignore: basic
etri: collide-edge-tri
vertex-ptr: inline-array
outward: vector
edge-vec-norm: vector
Methods
no-collision-at-edge(obj: collide-edge-edge, arg0: collide-edge-work, arg1: edge-grab-info) => symbolsource
collide-edge-hold-item: structuresource
Fields
next: collide-edge-hold-item
rating: float
split: int8
edge: collide-edge-edge
center-pt: vector
outward-pt: vector
collide-edge-hold-list: structuresource
Fields
num-allocs: uint32
num-attempts: uint32
head: collide-edge-hold-item
items: collide-edge-hold-item
attempts: qword
Methods
debug-draw(obj: collide-edge-hold-list) => objectsource
add-to-list!: unknown
collide-edge-spec: structuresource
Fields
split-dists: float
outward-offset: vector
flags: collide-edge-spec-flags
ignore-pat: pat-surface
max-dist-sqrd-to-outward-pt: float
max-dir-cosa-delta: float
max-dir-cosa-player: float
touching-segment: symbol
local-cache-fill-box: bounding-box
local-within-reach-box: bounding-box
local-player-spheres: sphere
local-player-hanging-spheres: sphere
local-player-leap-up-spheres: sphere
collide-edge-tri: structuresource
collide-edge-work: structuresource
Fields
ccache: collide-cache
cshape: collide-shape
num-verts: uint32
num-edges: uint32
num-tris: uint32
cache-fill-box: bounding-box
within-reach-box: bounding-box
within-reach-box4w: bounding-box4w
search-pt: vector
search-dir-vec: vector
world-player-spheres: sphere
world-player-hanging-spheres: sphere
world-player-leap-up-spheres: sphere
spec: collide-edge-spec
process: pointer
verts: vector
edges: collide-edge-edge
tris: collide-edge-tri
hold-list: collide-edge-hold-list
Methods
search-for-edges(obj: collide-edge-work, arg0: collide-edge-hold-list) => nonesource
debug-draw-edges(obj: collide-edge-work) => objectsource
debug-draw-tris(obj: collide-edge-work) => nonesource
debug-draw-sphere(obj: collide-edge-work) => nonesource
find-adjacent-edge(obj: collide-edge-work, arg0: collide-edge-hold-item, arg1: edge-grab-info) => nonesource
compute-center-point!(obj: collide-edge-work, arg0: collide-edge-edge, arg1: vector) => floatsource
get-best-hand-point(obj: collide-edge-work, arg0: vector, arg1: vector, arg2: int) => floatsource
find-grabbable-edges: unknown
find-grabbable-tris: unknown
should-add-to-list?: unknown
find-best-grab!: unknown
check-grab-for-collisions(obj: collide-edge-work, arg0: collide-edge-hold-item, arg1: edge-grab-info) => symbolsource
edge-grab-info: structuresource
Fields
world-vertex: vector
local-vertex: vector
status: uint64
actor-cshape-prim-offset: int32
actor-handle: handle
hanging-matrix: matrix
edge-vertex: vector
center-hold: vector
tri-vertex: vector
adjacent-edge-left-vertex: vector
adjacent-edge-right-vertex: vector
left-hand-hold: vector
right-hand-hold: vector
center-hold-old: vector
edge-tri-pat: uint32
found-edge?: symbol
pilot-edge-grab?: symbol
pilot-edge-grab: pilot-edge-grab-info
pilot-start-grab-pos: vector
pilot-grab-interp: float
Methods
edge-grab-info-method-9: unknown
debug-draw(obj: edge-grab-info) => nonesource
Variables
Types
faei-stack-vars: structuresource
pbhp-stack-vars: structuresource
Variables
Types
collide-frag-mesh: basicsource
collide-fragment: drawablesource
drawable-inline-array-collide-fragment: drawable-inline-arraysource
drawable-tree-collide-fragment: drawable-treesource
Expand description
This file contains the primitive intersection functions used for collision.
Most take a description of primitive and a "probe"
The probe has an origin and a direction. The length of the direction vector is the length
of the probe.
Generally, collision functions will return the fraction of the probe to reach the primitive.
For example, if the probe is 5.0 long, and hits the primitive 2.0 away from the probe origin,
the return value (u) would be 0.4.
If (u) would be > 1.0, then it counts as "not intersecting" (object too far away)
If (u) would be < 0.0, then it counts as "not intersecting" (object behind probe)
If there's a miss, return COLLISION_MISS, a large negative number.
If we are inside of the primitive, return 0.0
Functions
moving-sphere-sphere-intersect(arg0: vector, arg1: vector, arg2: vector, arg3: vector) => floatsource
pc-port-raw-ray-sphere-implementation(rad: float, vf1-val: vector, vf2-val: vector) => floatsource
This is one of the main primitives for collision.
Assumes a sphere of radius rad is at the origin.
Handles:
- miss (return MISS)
- behind (return MISS)
- too far away (return MISS)
- inside (return 0)
raw-ray-sphere-intersect(arg0: float) => floatsource
DANGER: this function takes two arguments by vf registers.
As a result, it doesn't work properly in OpenGOAL. See the functions below.
ray-circle-intersect(ray-origin: vector, ray-dir: vector, circle-origin: vector, radius: float) => floatsource
Intersect ray with circle. Circle is on the y plane and this throws out the y components
of ray-origin, circle-origin, and ray-dir
ray-cylinder-intersect(ray-origin: vector, ray-dir: vector, cyl-origin: vector, cyl-axis: vector, cyl-rad: float, cyl-len: float, pt-out: vector) => floatsource
Intersect with a cylinder.
Currently this is untested.
ray-plane-intersect(arg0: vector, arg1: vector, arg2: vector, arg3: vector, arg4: vector, arg5: vector, arg6: vector) => floatsource
Unused.
ray-sphere-intersect(ray-origin: vector, ray-dir: vector, sph-origin: vector, radius: float) => floatsource
Intersect a ray and sphere. Will return 0 if you are in the sphere, -huge number if you don't hit it.
Returns the length of the ray to the first intersection.
Variables
COLLISION_MISS: unknownsource
Types
collide-query: structuresource
Fields
best-other-tri: collide-tri-result
best-my-tri: collide-tri-result
ignore-processes: process-tree
ignore-process0: process-tree
ignore-process1: process-tree
ignore-pat: pat-surface
ignore-pat-s32: int32
collide-with: collide-spec
collide-with-s32: int32
overlay-params: uint32
bbox: bounding-box
bbox4w: bounding-box4w
bsphere: sphere
start-pos: vector
move-dist: vector
rlength: vector
exit-planes: plane
radius: float
inv-mat: matrix
spheres: inline-array
num-spheres: uint32
solid-only: symbol
best-dist: float
best-other-prim: collide-shape-prim
best-my-prim: collide-shape-prim
move-vec: vector
best-u: float
action-mask: collide-action
local-box4w: bounding-box4w
search-box: bounding-box4w
search-vector: vector4w
instance-mat: matrix
instance-ptr: basic
x-addr: uint32
x-step: uint32
y-addr: uint32
y-step: uint32
z-addr: uint32
z-step: uint32
Variables
*collide-test-flag*: symbolsource
Types
collide-mesh: basicsource
Fields
type: type
joint-id: int32
num-tris: uint32
num-verts: uint32
vertex-data: inline-array
tris: collide-mesh-tri
Methods
debug-draw-tris(obj: collide-mesh, arg0: process-drawable, arg1: int) => nonesource
overlap-test(obj: collide-mesh, arg0: collide-mesh-cache-tri, arg1: vector) => symbolsource
should-push-away-test(obj: collide-mesh, arg0: collide-mesh-cache-tri, arg1: collide-tri-result, arg2: vector, arg3: float) => floatsource
sphere-on-platform-test: unknown
unpack-mesh-to-cache!(obj: collide-mesh, arg0: inline-array, arg1: matrix) => nonesource
Unpack mesh and store in cache.
Transform triangles, computes normals and bbox.
collide-mesh-math-1: unknown
collide-mesh-math-2: unknown
collide-mesh-cache: basicsource
Fields
type: type
used-size: uint32
max-size: uint32
id: uint32
data: uint8
Methods
populate-for-prim-mesh(obj: collide-mesh-cache, arg0: collide-shape-prim-mesh) => collide-mesh-cache-entrysource
Populate the mesh cache for the given prim-mesh.
Will reuse existing data only if the transform and object are the same.
is-id?(obj: collide-mesh-cache, arg0: int) => symbolsource
next-id!(obj: collide-mesh-cache) => uintsource
Reset all used entries in the cache and increment the id.
If the id is zero, set it to 1
allocate!(obj: collide-mesh-cache, arg0: int) => collide-mesh-cache-entrysource
Allocate room in the collide-mesh-cache for an unpacked mesh with arg0 tris.
collide-mesh-cache-entry: structuresource
collide-mesh-cache-tri: structuresource
collide-mesh-tri: structuresource
collide-tri-result: structuresource
Expand description
note: this file has patched functions
this file has functions for foreground mesh collision functions. This is for stuff like jak being on a platform, or a
platform pushing jak away.
The "collide-mesh" is the foreground collision mesh type. These can be used as part of a collide-shape.
These can be added to the normal "collide-cache" and work with the most common collision queries.
However, there are a few special case collision queries that use a separate collide-mesh-cache.
The intented use is something like this:
- a mesh is unpacked to the collide-mesh-cache
- primitive vs. mesh tests are done using the unpacked data, reusing the data.
This collide-mesh-cache is limited compared to the real collide cache - this can only hold
a single mesh, so it's limited to tests like single foreground mesh vs. sphere.
Another limitation is that triangles don't have per-tri pat info.
Types
oot-work: structuresource
sopt-work: structuresource
spat-work: structuresource
Expand description
this file is unused in jak 2.
a number of functions require a bunch of annoying casts/mips2c stuff, but are unused.
Types
collide-probe-stack: structuresource
Fields
data: collide-probe-stack-elem
Functions
creates-new-method?(arg0: type, arg1: int) => symbolsource
describe-methods(arg0: type) => symbolsource
interpolate(arg0: float, arg1: float, arg2: float, arg3: float, arg4: float) => floatsource
misty-ambush-height(arg0: vector) => floatsource
misty-ambush-height-probe(arg0: vector, arg1: float) => floatsource
overrides-parent-method?(arg0: type, arg1: int) => symbolsource
pke-collide-test() => nonesource
probe-traverse-collide-fragment(arg0: drawable-tree-collide-fragment, arg1: int) => nonesource
probe-traverse-draw-node(arg0: draw-node, arg1: int) => nonesource
probe-traverse-inline-array-node(arg0: drawable-inline-array-node, arg1: int) => nonesource
Variables
const collide-vu0-block: vu-functionsource
Types
collide-prim-core: structuresource
collide-rider: structuresource
collide-rider-pool: basicsource
Fields
type: type
alloc-count: int32
riders: collide-rider
Methods
add-rider(obj: collide-rider-pool, arg0: handle) => collide-ridersource
prepare(obj: collide-rider-pool) => nonesource
Gets this pool ready to be used to allow allocations. This should be called once at the start of every frame.
collide-shape: trsqvsource
Fields
type: type
trans: vector
rot: vector
scale: vector
quat: quaternion
pause-adjust-distance: meters
nav-radius: meters
transv: vector
rotv: vector
scalev: vector
dir-targ: quaternion
angle-change-time: time-frame
old-y-angle-diff: float
actor-hash-index: int16
process: process-drawable
max-iteration-count: uint8
nav-flags: nav-flags
total-prims: uint8
num-riders: uint8
pat-ignore-mask: pat-surface
event-self: symbol
event-other: symbol
root-prim: collide-shape-prim
riders: inline-array
penetrate-using: penetrate
penetrated-by: penetrate
backup-collide-as: collide-spec
backup-collide-with: collide-spec
event-priority: uint8
rider-max-momentum: float
Methods
move-by-vector!(obj: collide-shape, arg0: vector) => nonesource
Move everything by a vector.
move-to-point!(obj: collide-shape, arg0: vector) => nonesource
Move root to a point.
debug-draw(obj: collide-shape) => nonesource
fill-cache-for-shape(obj: collide-shape, arg0: float, arg1: collide-query) => nonesource
Fill the collide cache for a collide-shape by buliding a bounding box and filling from that.
fill-cache-integrate-and-collide(obj: collide-shape, arg0: vector, arg1: collide-query, arg2: meters) => nonesource
Helper to fill the collide cache and call integrate-and-collide.
find-prim-by-id(obj: collide-shape, arg0: uint) => collide-shape-primsource
find-prim-by-id-logtest(obj: collide-shape, arg0: uint) => collide-shape-primsource
detect-riders!(obj: collide-shape) => symbolsource
build-bounding-box-for-shape(obj: collide-shape, arg0: bounding-box, arg1: float, arg2: collide-spec) => symbolsource
integrate-and-collide!(obj: collide-shape, arg0: vector) => nonesource
find-collision-meshes(obj: collide-shape) => nonesource
Find collision meshes for our collide prims.
The collide shape system is built in code, so this function should be called
to actually find the matching meshes.
on-platform(obj: collide-shape, arg0: collide-shape, arg1: collide-query) => symbolsource
find-overlapping-shapes(obj: collide-shape, arg0: overlaps-others-params) => symbolsource
shove-to-closest-point-on-path(obj: collide-shape, arg0: attack-info, arg1: float) => vectorsource
should-push-away(obj: collide-shape, other: collide-shape, cquery: collide-query) => symbolsource
Should this shape push away the other? Most generic implementation.
pull-rider!(obj: collide-shape, arg0: pull-rider-info) => nonesource
pull-riders!(obj: collide-shape) => symbolsource
do-push-aways(obj: collide-shape) => collide-specsource
Push away things.
update-transforms(obj: collide-shape) => nonesource
Update collisision transforms.
set-collide-with!(obj: collide-shape, arg0: collide-spec) => nonesource
Set the collide with field of everything.
set-collide-as!(obj: collide-shape, arg0: collide-spec) => nonesource
Set the collide as field of everything
modify-collide-as!(obj: collide-shape, arg0: int, arg1: collide-spec, arg2: collide-spec) => nonesource
send-shoves(obj: collide-shape, arg0: process, arg1: touching-shapes-entry, arg2: float, arg3: float, arg4: float) => symbolsource
above-ground?(obj: collide-shape, arg0: collide-query, arg1: vector, arg2: collide-spec, arg3: float, arg4: float, arg5: float) => symbolsource
water-info-init!(obj: collide-shape, arg0: water-info, arg1: collide-action) => water-infosource
Initialize a water-info with the currently loaded regions.
iterate-prims(obj: collide-shape, arg0: function) => nonesource
Call the given function for each prim.
pusher-init(obj: collide-shape) => nonesource
Initialize a collide-shape as a pusher and move it to the pusher pool.
collide-shape-moving: collide-shapesource
Fields
type: type
trans: vector
rot: vector
scale: vector
quat: quaternion
pause-adjust-distance: meters
nav-radius: meters
transv: vector
rotv: vector
scalev: vector
dir-targ: quaternion
angle-change-time: time-frame
old-y-angle-diff: float
actor-hash-index: int16
process: process-drawable
max-iteration-count: uint8
nav-flags: nav-flags
total-prims: uint8
num-riders: uint8
pat-ignore-mask: pat-surface
event-self: symbol
event-other: symbol
root-prim: collide-shape-prim
riders: inline-array
penetrate-using: penetrate
penetrated-by: penetrate
backup-collide-as: collide-spec
backup-collide-with: collide-spec
event-priority: uint8
rider-max-momentum: float
rider-time: time-frame
rider-last-move: vector
trans-old: vector
trans-old-old: vector
trans-old-old-old: vector
poly-pat: pat-surface
cur-pat: pat-surface
ground-pat: pat-surface
status: collide-status
old-status: collide-status
prev-status: collide-status
reaction-flag: cshape-reaction-flags
reaction: function
no-reaction: function
local-normal: vector
surface-normal: vector
poly-normal: vector
ground-poly-normal: vector
gspot-pos: vector
gspot-normal: vector
grount-touch-point: vector
ground-impact-vel: meters
surface-angle: float
poly-angle: float
touch-angle: float
coverage: float
dynam: dynamics
surf: surface
Methods
find-ground(obj: collide-shape-moving, arg0: collide-query, arg1: collide-spec, arg2: float, arg3: float, arg4: float) => symbolsource
Find the ground, return #t if we found it, and fill out gspot in the collide-query.
react-to-pat!(obj: collide-shape-moving, arg0: pat-surface) => intsource
React to colliding with the given 'pat'.
integrate-no-collide!(obj: collide-shape-moving, arg0: vector) => nonesource
Move, ignoring all collision.
integrate-for-enemy-no-mtg(obj: collide-shape-moving, arg0: vector, arg1: overlaps-others-params) => symbolsource
Simpler move for enemy, with no moving to ground. Will just stop if the move collides.
move-above-ground(obj: collide-shape-moving, arg0: vector, arg1: move-above-ground-params) => nonesource
Move at the given velocity, while not going through the ground
move-to-ground(obj: collide-shape-moving, arg0: float, arg1: float, arg2: symbol, arg3: collide-spec) => nonesource
Find the ground a move to it.
move-to-ground-point(obj: collide-shape-moving, arg0: vector, arg1: vector, arg2: vector) => nonesource
Move to point, and treat as ground.
compute-acc-due-to-gravity(obj: collide-shape-moving, arg0: vector, arg1: float) => vectorsource
Adjust the velocity from the acceleration of gravity.
collide-shape-moving-method-63(obj: collide-shape-moving, arg0: rigid-body, arg1: float) => nonesource
try-snap-to-surface(obj: collide-shape-moving, vel: vector, check-dist: float, amt: float, bounce-dist: float) => symbolsource
Strange function to try to find a surface and move to it.
Teleports a distance of check-dist, then moves back to the start point plus amt.
If this move hits something, moves to that surface, then an additional bounce-dist.
I have no idea what this is used for - it kinda seems like this is a hack to make sure that
projectiles that start inside something will hit that thing.
fill-and-try-snap-to-surface(obj: collide-shape-moving, arg0: vector, arg1: float, arg2: float, arg3: float, arg4: collide-query) => symbolsource
Fill the collision cache and try to snap to a nearby surface.
step-collison!(obj: collide-shape-moving, arg0: vector, arg1: vector, arg2: float, arg3: int) => floatsource
Main function to move forward until we hit a single thing, then react.
collide-with-all-collide-cache-prims(obj: collide-shape-moving, arg0: matrix, arg1: collide-query) => nonesource
collide-shape-prim: basicsource
Fields
type: type
cshape: collide-shape
prim-id: uint32
transform-index: int8
unused2: int8
prim-core: collide-prim-core
local-sphere: vector
world-sphere: vector
collide-as: collide-spec
collide-with: collide-spec
action: collide-action
prim-type: int8
radius: float
specific: uint8
Methods
debug-draw(obj: collide-shape-prim) => nonesource
add-fg-prim-using-box(obj: collide-shape-prim, arg0: collide-cache) => nonesource
add-fg-prim-using-line-sphere(obj: collide-shape-prim, arg0: collide-cache, arg1: object) => nonesource
overlaps-others-test(obj: collide-shape-prim, arg0: overlaps-others-params, arg1: collide-shape-prim) => symbolsource
overlaps-others-group(obj: collide-shape-prim, arg0: overlaps-others-params, arg1: collide-shape-prim-group) => symbolsource
collide-shape-prim-method-14: unknown
collide-with-collide-cache-prim-mesh(obj: collide-shape-prim, arg0: collide-query, arg1: collide-cache-prim) => nonesource
collide-with-collide-cache-prim-sphere(obj: collide-shape-prim, arg0: collide-query, arg1: collide-cache-prim) => nonesource
on-platform-test(obj: collide-shape-prim, arg0: collide-shape-prim, arg1: collide-query, arg2: float) => nonesource
should-push-away-test(obj: collide-shape-prim, arg0: collide-shape-prim, arg1: collide-query) => nonesource
Most generic should-push-away-test - child prims are expected to override.
should-push-away-a-group-test(obj: collide-shape-prim, other: collide-shape-prim-group, cquery: collide-query) => nonesource
should-push-away-test anything vs. a group.