feat: 更新 IntoHole 的球体、滑槽和环境资产
- 为铁球、陶瓷球和木球制作风格化材质,归档 CC0 原始参考 - 更新方形球洞和实心滑槽,统一 90° 弯槽并兼容旧存档 - 用顺流泡沫表示水流方向,为冰块制作三种交错的裂纹 - 同步 Blender 源资产、Godot 加载、工坊和试玩预览
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
extends Node3D
|
||||
|
||||
# One collision event, measured in N*s; do not sum resting support over time.
|
||||
const BREAK_IMPULSE := 1000.0
|
||||
const MIN_APPROACH_SPEED := 0.5
|
||||
var broken := false
|
||||
var events: Array=[]
|
||||
var peak_impulse := 0.0
|
||||
var pending_break := false
|
||||
|
||||
func receive_impact(ball_id: String, impulse: float, approach: float) -> void:
|
||||
if broken or pending_break or approach<MIN_APPROACH_SPEED:return
|
||||
peak_impulse=maxf(peak_impulse,impulse)
|
||||
var should_break:=impulse>=BREAK_IMPULSE
|
||||
events.append({"ballId":ball_id,"normalImpulseNs":impulse,"approachSpeedMps":approach,
|
||||
"thresholdNs":BREAK_IMPULSE,"breaks":should_break,"tick":Engine.get_physics_frames()})
|
||||
if should_break:
|
||||
pending_break=true
|
||||
call_deferred("break_block")
|
||||
|
||||
func set_solids(node: Node, enabled: bool) -> void:
|
||||
if node is StaticBody3D:
|
||||
node.collision_layer=1 if enabled else 0
|
||||
node.collision_mask=2 if enabled else 0
|
||||
for child in node.get_children():set_solids(child,enabled)
|
||||
|
||||
func break_block() -> void:
|
||||
broken=true;pending_break=false
|
||||
set_solids(self,false)
|
||||
# Visual shards are deliberately not additional dynamic physics objects.
|
||||
hide()
|
||||
|
||||
func reset_block() -> void:
|
||||
broken=false;pending_break=false;events.clear();peak_impulse=0
|
||||
set_solids(self,true);show()
|
||||
Reference in New Issue
Block a user