🦇 3D BOIDs群飛アルゴリズム、高度制限と旋回物理計算
📌 リポジトリソースコードに関する免責事項: 本Wikiドキュメントはリポジトリの最新ソースコード状態を反映しており、CurseForgeやModrinthで公開されているリリース版に含まれない開発中機能を含む場合があります。
| Math Parameter | Symbol | Value / Formula | Description |
|---|---|---|---|
| Separation Radius | $r_{\text{sep}}$ | 1.5 blocks | Minimum distance before repulsion force triggers |
| Neighbor Radius | $r_{\text{nbr}}$ | 8.0 blocks | Bounding sphere for cohesion and alignment |
| Cohesion Weight | $W_{\text{coh}}$ | 0.02 | Force pulling towards average flock centroid |
| Alignment Weight | $W_{\text{ali}}$ | 0.05 | Force matching average velocity vector of neighbors |
| Separation Weight | $W_{\text{sep}}$ | 0.08 | Force pushing away from overlapping bats |
| Max Acceleration | $a_{\text{max}}$ | 0.05 blocks/tick² | Maximum steering delta applied per tick |
🧮 3次元BOIDsアルゴリズムの数式モデル
The composite steering force applied to each bat per tick is governed by the classic Reynolds BOIDs vector equation:
$$\vec{F}{\text{steer}} = W{\text{coh}}\vec{F}{\text{cohesion}} + W{\text{ali}}\vec{F}{\text{alignment}} + W{\text{sep}}\vec{F}_{\text{separation}}$$
Where each component vector is evaluated against the set of $N$ visible flock neighbors:
$$\vec{F}{\text{cohesion}} = \frac{1}{N}\sum^N (\vec{P}i - \vec{P}{\text{self}})$$ $$\vec{F}{\text{alignment}} = \frac{1}{N}\sum^N \vec{V}i - \vec{V}{\text{self}}$$ $$\vec{F}{\text{separation}} = \sum^M \frac{\vec{P}_{\text{self}} - \vec{P}j}{|\vec{P}{\text{self}} - \vec{P}_j|^2}$$
☕ 個人開発者ノート: 3D BOIDsによるコウモリのリアルな群飛やグアノによる作物施肥を気に入っていただけたら、ぜひ Ko-fi でのご支援をお願いします!
📈 地表高度制限の計算
To prevent bats from soaring into upper atmospheric void or despawn ceilings, BatFlightHelper samples the terrain height $Y_{\text{surface}}$ directly below the bat and applies a downward restoration force when $Y > Y_{\text{surface}} + 12$:
$$F_y = -0.04 \times \frac{Y - (Y_{\text{surface}} + 12)}{4.0}$$
Next: 走光性と夜間灯火旋回 | 害虫駆除と急降下戦闘
