CMovement::LimitFaceRise
function · collision · primitive
- Address
0x635c00· 376 bytes, up to0x635d77- Signature
float * __thiscall (CMovement *this, float *out, const float *dir, float *len, float nx, float ny, float nz, uint32_t flip, const float *contact)- Meaning
- Writes (0, 0, rise) for moving len along dir on a face, limiting the rise to the step height and scaling len
- Confidence
- verified, proof one
- Finding
- collision/walking#rise-along-a-face
- Test
collision::speed_select_difftest
Finding: Rise along a face in collision: walking
0x635c00(out, dir, &len, n, flip, B) gives the height change h of moving len along dir on
the plane n, h = float(−(n·dir)·len / n.z), and limits it to H. When flip is nonzero,
n.z ≤ cos 50° and |B|² ≥ 2^-22, n is replaced by −B, the contact vector, so the rise
follows B's slope, h = float(−(B·dir)·len / B.z), instead of the face's. For |n.z| < 2^-22, h is −FLT_MAX when the numerator is negative, else +FLT_MAX. The
output is (0·X, 0·X, X) (0x635d5b): x and y are −0 for a negative X and NaN for a NaN
one.
| case, in test order | len | X |
|---|---|---|
| flag 0x4000000 and h < 0 | 0 | H |
| H < h | float(H/h·len) | H |
| h < −H | float(−(H/h·len)) | −H |
| otherwise, NaN included | kept | h |
The derivation is in the doc.
Callers 2
- CMovement::ProbeStepUp collision
- CMovement::ResolveWalk collision
Callees 1
- CMovement::GetScaleRatio collision
Calls and jumps by a bare address, from tables/calls.tsv.