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

Function NPC_spdBasedColFreq

src/SB/Core/x/xNPCBasic.cpp:136–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136void NPC_spdBasedColFreq(xNPCBasic* npc, F32 dt)
137{
138 if (dt < 1e-5f)
139 {
140 return;
141 }
142 F32 d = xVec3Length(&npc->frame->vel);
143 if (d < 0.2f)
144 {
145 return;
146 }
147
148 F32 radius;
149 if (npc->bound.type == XBOUND_TYPE_SPHERE)
150 {
151 radius = npc->bound.sph.r;
152 }
153 else
154 {
155 radius = MAX(npc->bound.box.box.upper.x - npc->bound.box.box.lower.x,
156 npc->bound.box.box.upper.z - npc->bound.box.box.lower.z);
157 }
158
159 S32 nf = 30.0f * (radius / d);
160 npc->colFreq = MIN(npc->colFreq, nf);
161}
162
163void xNPCBasic::Process(xScene* xscn, F32 dt)
164{

Callers 1

ProcessMethod · 0.70

Calls 1

xVec3LengthFunction · 0.85

Tested by

no test coverage detected