benilla-re systems structs docs

CMovement::ComputeWallNormal

function · collision · primitive

Address
0x634ae0 · 691 bytes, up to 0x634d92
Signature
float * __thiscall (CMovement *this, float *out, uint32_t index, const float *planes, uint32_t count)
Meaning
Picks a hit's wall normal from its contact planes: the triangle's, the first plane's, or a crease's
Confidence
verified, proof one
Finding
collision/airborne#wall-normal-from-contacts
Test
collision::slide_normal_difftest

Finding: Wall normal from contacts in collision: airborne

0x634ae0(out, i, planes, count) picks the wall normal from the contact planes 0x632ba0 reported: count 3 or 4 gives triangle i's normal; 0, 1 or more than 4 give −planes[0].n. For 2, c = planes[0].n × planes[1].n, normalized. It gives triangle i's normal when |c.z| < 2^-20, when |c·n_i| < 2^-20, or when |c.z − 1| ≥ 2^-20 and 0x634960 finds i's plane within 1/720 of the position or of a corner (x ± r, y ± r, z + 1.8493990·r). Else P = the point on all three planes (0x634fc0), e = the edge of i nearest the line through P along c (0x634da0), w = c × e normalized, and it returns −w when w·planes[0].n > 0, else w; −planes[0].n when |c × e| < 2^-22.

The derivation is in the doc.

Callers 1

Callees 5

Calls and jumps by a bare address, from tables/calls.tsv.