🏮 趨光性與夜間燈火環繞巡飛
📌 代碼倉庫原始碼免責聲明:本維基文件反映了倉庫當前的原始碼狀態,可能包含領先於 CurseForge 與 Modrinth 上公開發布版本的最新開發提交或未發布功能。
| Parameter | Specification Details |
|---|---|
| AI Goal Class | net.vanillaoutsider.betterbats.ai.BatHuntLightGoal |
| Detection Light Level | Block Light > 8 (LIGHT_DETECT_THRESHOLD) |
| Continue Light Level | Block Light > 6 (LIGHT_CONTINUE_THRESHOLD) |
| Search Radius | 10 blocks (Deterministic BlockPos.findClosestMatch) |
| Search Throttle | Executes light search once every 30 ticks (~1.5s) |
| Orbit Duration | 200 to 600 ticks ($10 - 30\text{ seconds}$) |
| Goal Cooldown | 200 to 400 ticks ($10 - 20\text{ seconds}$) |
| Approach Mode | Curved banking flight vector ($d > 2.5\text{ blocks}$) |
| Orbiting Mode | Tangential velocity vector with sine-wave vertical bobbing |
| Visual Particles | CRIT (10% tick probability during orbit) |
☕ 獨立開發者寄語:如果你喜歡蝙蝠逼真的三維群飛和鳥糞為莊稼施肥的生態體驗,歡迎在 Ko-fi 上支持我的獨立開發!
🌙 飛蛾效應 (The Moth Effect)
At night, bats are attracted to artificial light sources (torches, lanterns, campfires, sea lanterns). When within 10 blocks of a valid light block with Block Light > 8, BatHuntLightGoal activates. Bats approach the light and transition into smooth circular orbits.
📐 切向旋回向量數學
The orbital velocity vector is calculated perpendicularly to the radial position vector $\vec{r} = \vec{P}{\text{bat}} - \vec{P}{\text{light}}$:
$$\vec{V}{\text{tangent}} = \frac{(-r_z, 0, r_x)}{|\vec{r}|} \times v{\text{orbit}}$$
A sine-wave vertical modulation adds organic natural bobbing:
$$V_y = A \sin(\omega t)$$
