Fix NaN position bug with fixed collision (#312)

* Fix fixed collision NaN position

Thanks to @Marioiscool246 for figuring this out.
Sometimes Mario's position will become NaN when doing specific things, this fixes that.

Co-Authored-By: Marioiscool246 <27823923+Marioiscool246@users.noreply.github.com>

* Formatting

Co-Authored-By: Marioiscool246 <27823923+Marioiscool246@users.noreply.github.com>

* Fix ordering

* Final fix(?)

---------

Co-authored-by: Marioiscool246 <27823923+Marioiscool246@users.noreply.github.com>
This commit is contained in:
Agent X 2023-03-20 21:13:02 -04:00 committed by GitHub
parent 42b43a9b7e
commit 7f6f7fea47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -164,6 +164,10 @@ static s32 find_wall_collisions_from_list(struct SurfaceNode *surfaceNode,
f32 dist = sqrtf(dX * dX + dZ * dZ);
if (dist > radius) { continue; }
if (dist < __FLT_EPSILON__) {
dist = __FLT_EPSILON__;
}
cNorm[0] = dX / dist;
cNorm[1] = 0;
cNorm[2] = dZ / dist;