| 134 | } |
| 135 | |
| 136 | void 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 | |
| 163 | void xNPCBasic::Process(xScene* xscn, F32 dt) |
| 164 | { |