MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / xSphereHitsVCylinder

Function xSphereHitsVCylinder

src/SB/Core/x/xCollide.cpp:2495–2516  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2493 {
2494 sr = xsqrt(SQR(sr) - SQR(ydist - ch));
2495 }
2496
2497 xVec2 xzloc1 = { sc.x, sc.z };
2498 xVec2 xzloc2 = { cc.x, cc.z };
2499 F32 xzdist2 = (xzloc2 - xzloc1).length2();
2500 F32 max_xzdist = sr + cr;
2501
2502 return !(xzdist2 > SQR(max_xzdist));
2503}
2504
2505bool xSphereHitsVCircle(const xVec3& sc, F32 sr, const xVec3& cc, F32 cr)
2506{
2507 F32 ydist = cc.y - sc.y;
2508 if (ydist < -sr || ydist > sr)
2509 return false;
2510
2511 sr = xsqrt(SQR(sr) - SQR(ydist));
2512
2513 xVec2 xzloc1 = { sc.x, sc.z };
2514 xVec2 xzloc2 = { cc.x, cc.z };
2515 F32 xzdist2 = (xzloc2 - xzloc1).length2();
2516 F32 max_xzdist = sr + cr;
2517
2518 return !(xzdist2 > SQR(max_xzdist));
2519}

Callers 1

zEntTriggerHitsSphereFunction · 0.50

Calls 2

xsqrtFunction · 0.85
length2Method · 0.45

Tested by

no test coverage detected