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

Function xSphereHitsBox

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

Source from the content-addressed store, hash-verified

186 coll->flags &= 0xfffffffe;
187 }
188 else
189 {
190 if (isx.contained <= 0.0f)
191 {
192 coll->flags |= 0x10;
193 }
194 coll->dist = isx.dist;
195 if (coll->flags & 0x0400)
196 {
197 xVec3Copy(&coll->tohit, &isx.norm);
198 }
199 if ((coll->flags & 0x800) != 0)
200 {
201 if (isx.dist == 0.0f)
202 {
203 xVec3Copy(&coll->depen, &g_O3);
204 }
205 else
206 {
207 xVec3SMul(&coll->depen, &isx.norm, isx.penned / isx.dist);
208 }
209 }
210 if ((coll->flags & 0x1200) != 0)
211 {
212 xVec3Normalize(&coll->hdng, &isx.norm);
213 }
214 if ((coll->flags & 0x200) != 0)
215 {
216 xVec3Inv(&coll->norm, &coll->hdng);
217 }
218 uVar1 = 1;
219 coll->flags |= 1;
220 }
221 return uVar1;
222}
223
224U32 xSphereHitsOBB_nu(const xSphere* s, const xBox* b, const xMat4x3* m, xCollis* coll)
225{
226 xSphere xfs;
227 xVec3 scale;
228 xMat4x3 mnormal;
229
230 xVec3NormalizeMacro(&mnormal.right, &m->right, &scale.x);
231 xVec3NormalizeMacro(&mnormal.up, &m->up, &scale.y);
232 xVec3NormalizeMacro(&mnormal.at, &m->at, &scale.z);
233 mnormal.pos = m->pos;
234
235 xBox sbox = *b;
236 sbox.upper.x *= scale.x, sbox.upper.y *= scale.y, sbox.upper.z *= scale.z;
237 sbox.lower.x *= scale.x, sbox.lower.y *= scale.y, sbox.lower.z *= scale.z;
238

Callers 2

xSphereHitsOBB_nuFunction · 0.70
xSphereHitsBoundFunction · 0.70

Calls 5

xVec3CopyFunction · 0.85
xVec3SMulFunction · 0.85
xVec3InvFunction · 0.85
xVec3NormalizeFunction · 0.70
iBoxIsectSphereFunction · 0.50

Tested by

no test coverage detected