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

Function xSweptSphereToScene

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

Source from the content-addressed store, hash-verified

2231 xRay3 ray;
2232 xVec3Copy(&ray.origin, &sws->start);
2233 xVec3Sub(&ray.dir, &sws->end, &sws->start);
2234 ray.max_t = xVec3Length(&ray.dir);
2235
2236 F32 one_len = 1.0f / MAX(ray.max_t, 0.00001f);
2237 xVec3SMul(&ray.dir, &ray.dir, one_len);
2238
2239 ray.flags = XRAY3_USE_MAX;
2240 if (!(ray.flags & XRAY3_USE_MIN))
2241 {
2242 ray.flags |= XRAY3_USE_MIN;
2243 ray.min_t = 0.0f;
2244 }
2245
2246 xRayHitsGrid(&colls_grid, sc, &ray, SweptSphereHitsEntCB, &sws->qcd, sws);
2247 xRayHitsGrid(&colls_oso_grid, sc, &ray, SweptSphereHitsEntCB, &sws->qcd, sws);
2248 xRayHitsGrid(&npcs_grid, sc, &ray, SweptSphereHitsEntCB, &sws->qcd, sws);
2249
2250 return sSweptSphereEntFound || envcollfound;
2251}
2252
2253S32 xSweptSphereToStatDyn(xSweptSphere* sws, xScene* sc, xEnt* mover, U8 collType)
2254{
2255 if (sws->dist == 0.0f)
2256 return 0;
2257
2258 sSweptSphereEntFound = 0;
2259 sSweptSphereMover = mover;
2260 sSweptSphereCollType = collType;
2261
2262 xRay3 ray;
2263 xVec3Copy(&ray.origin, &sws->start);
2264 xVec3Sub(&ray.dir, &sws->end, &sws->start);
2265 ray.max_t = xVec3Length(&ray.dir);
2266
2267 F32 one_len = 1.0f / MAX(ray.max_t, 0.00001f);

Callers 2

DoWallJumpCheckFunction · 0.50
hit_testMethod · 0.50

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