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

Function xSweptSphereToNonMoving

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

Source from the content-addressed store, hash-verified

2323 xRay3 ray;
2324 xVec3Copy(&ray.origin, &sws->start);
2325 xVec3Sub(&ray.dir, &sws->end, &sws->start);
2326 ray.max_t = xVec3Length(&ray.dir);
2327
2328 F32 one_len = 1.0f / MAX(ray.max_t, 0.00001f);
2329 xVec3SMul(&ray.dir, &ray.dir, one_len);
2330
2331 ray.flags = (XRAY3_USE_MAX);
2332 if (!(ray.flags & XRAY3_USE_MIN))
2333 {
2334 ray.flags |= XRAY3_USE_MIN;
2335 ray.min_t = 0.0f;
2336 }
2337
2338 sSweptSphereIgnoreMovers = 1;
2339 xRayHitsGrid(&colls_grid, sc, &ray, SweptSphereHitsEntCB, &sws->qcd, sws);
2340 xRayHitsGrid(&colls_oso_grid, sc, &ray, SweptSphereHitsEntCB, &sws->qcd, sws);
2341 sSweptSphereIgnoreMovers = 0;
2342
2343 return sSweptSphereEntFound || envcollfound;
2344}
2345
2346bool xSphereHitsBound(const xSphere& o, const xBound& b)
2347{
2348 switch (b.type)
2349 {
2350 case XBOUND_TYPE_SPHERE:
2351 return xSphereHitsSphere(o, b.sph);
2352 case XBOUND_TYPE_BOX:
2353 return xSphereHitsBox(o, b.box.box);
2354 case XBOUND_TYPE_OBB:
2355 return xSphereHitsOBB(o, b.box.box, *b.mat);
2356 }
2357 return false;
2358}
2359
2360U8 xOBBHitsOBB(const xBox& a, const xMat4x3& amat, const xBox& b, const xMat4x3& bmat)

Callers

nothing calls this directly

Calls 6

xVec3CopyFunction · 0.85
xVec3SubFunction · 0.85
xVec3LengthFunction · 0.85
xVec3SMulFunction · 0.85
xSweptSphereToEnvFunction · 0.70
xRayHitsGridFunction · 0.70

Tested by

no test coverage detected