feat: 切换至滚动阻力运行模型并更新资产、编辑器与验证

- 物理规则:现行模型仅保留滚动阻力耗能与恢复系数碰撞,风力、空气阻力、静摩擦、动摩擦不再参与运行;确认三球质量 60/330/约890 kg 及水密度、流阻参数
- 定向加速改为真实顶面接触触发的一次性 +5 m/s 速度事件,模型新增渐进式 U 形导槽出口
- 更新球体、滑槽、水/冰/墙、球洞模型与 storybook 目录、物理、实体配置
- 工坊摆放、编辑器、运行适配与检查脚本同步;删除过时的 baseline 三组检查
- 新增谜题设计参考文档、关卡草稿与本轮实验产物
This commit is contained in:
Yanchen
2026-12-05 10:37:31 +08:00
parent d1141b04c7
commit bf6c355fa6
132 changed files with 13205 additions and 1838 deletions
+38 -40
View File
@@ -351,10 +351,10 @@ func refresh_palette() -> void:
option.toggle_mode=true
option.button_pressed=block_mode!="erase" and (id==ball_kind if category=="balls" else id==kind)
if category=="balls":
option.tooltip_text={"wood_ball":"原木球:容易被风吹动","ceramic_ball":"陶瓷球:330 kg,在当前水域中下沉","iron_ball":"铁球:最重,普通风下难以推动"}[id]
option.tooltip_text={"wood_ball":"原木球:60 kg,在当前水域中浮起","ceramic_ball":"陶瓷球:330 kg,在当前水域中下沉","iron_ball":"铁球:约 890 kg,在当前水域中下沉"}[id]
elif id=="water":option.tooltip_text="水体可穿入;泡沫顺流漂动,水速固定 5 m/s。R 顺时针旋转 90°。"
elif id=="ice":option.tooltip_text="低摩擦冰面;强撞击会破碎,静置承重不触发。"
elif id=="wall":option.tooltip_text="实心墙壁;高摩擦、高滚动阻力,也可搭建河床和河岸。"
elif id=="ice":option.tooltip_text="低滚动阻力冰面;强撞击会破碎,静置承重不触发。"
elif id=="wall":option.tooltip_text="实心墙壁;高滚动阻力,也可搭建河床和河岸。"
palette_box.add_child(option)
for id in category_buttons:category_buttons[id].button_pressed=id==category
if block_controls!=null:block_controls.visible=category!="balls" and block_mode!="erase"
@@ -508,7 +508,7 @@ func add_spawn() -> void:
func refresh_ball_pick_hint() -> void:
if ball_pick_hint==null:return
ball_pick_hint.text="点击场景选位置,再点“放置小球”。\n滑槽会自动对准槽内。" if ball_pick_mode.selected==0 else "先设置球心 Y,再点击场景选 X/Z,\n最后点“放置小球”。"
ball_pick_hint.text="点方块选中顶面中央,点滑槽选中槽段中点。\n确认预览后点“放置小球”。" if ball_pick_mode.selected==0 else "先设置球心 Y,再点击场景选 X/Z,\n最后点“放置小球”。"
func ball_position_is_clear(at: Vector3) -> bool:
var shape:=SphereShape3D.new();shape.radius=lib.ball_radius(ball_kind)
@@ -516,37 +516,39 @@ func ball_position_is_clear(at: Vector3) -> bool:
query.transform=Transform3D(Basis.IDENTITY,at);query.collision_mask=1;query.margin=0
return get_world_3d().direct_space_state.intersect_shape(query).is_empty()
func ball_position_on_chute(hit: Dictionary) -> Variant:
var node: Node=hit.collider
while node!=null and not node.has_meta("record_id"):node=node.get_parent()
if node==null:return null
var record: Dictionary=records[index_for(node.get_meta("record_id"))]
if record.kind not in IDS:return null
var transform:=Transform3D(Basis(Vector3.UP,-int(record.quarter)*PI/2),lib.record_center(record))
var local: Vector3=transform.affine_inverse()*Vector3(hit.position)
var point:=Vector2(local.x,local.z)
var paths: Array=lib.catalog[record.kind].upperPaths
var distance:=INF;var best_t:=0.0;var best_branch:=0
for branch in range(paths.size()):
var path: Array=paths[branch]
for i in range(path.size()-1):
var a:=Vector2(path[i][0],path[i][2]);var b:=Vector2(path[i+1][0],path[i+1][2])
var segment:=b-a
var ratio:=clampf((point-a).dot(segment)/maxf(segment.length_squared(),.000001),0,1)
var d:=point.distance_squared_to(a+segment*ratio)
if d<distance:distance=d;best_t=(i+ratio)/(path.size()-1);best_branch=branch
var candidate: Vector3=(transform*lib.ball_on_surface(record.kind,best_t,best_branch)).snapped(Vector3.ONE*.01)
if ball_position_is_clear(candidate):return candidate
# At a seam a nearby wall can obstruct the ideal groove point. Find the
# closest clear point on this same asset without moving or altering any block.
var best_distance:=INF
for branch in range(paths.size()):
for i in range(paths[branch].size()):
var t: float=float(i)/(paths[branch].size()-1)
var alternative: Vector3=(transform*lib.ball_on_surface(record.kind,t,branch)).snapped(Vector3.ONE*.01)
var d: float=alternative.distance_squared_to(Vector3(hit.position))
if d<best_distance and ball_position_is_clear(alternative):candidate=alternative;best_distance=d
return candidate
func ball_position_on_block(hit: Dictionary) -> Variant:
var node: Node = hit.collider
while node != null and not node.has_meta("record_id"):
node = node.get_parent()
if node == null:
return null
var record: Dictionary = records[index_for(node.get_meta("record_id"))]
var center: Vector3 = lib.record_center(record)
if record.kind not in IDS:
var bounds: AABB = lib.record_bounds(record)
center.y = bounds.end.y
if record.kind == "directional_boost":
center.y = record.position.y + lib.catalog[record.kind].baseHeight
return center + Vector3.UP * (lib.ball_radius(ball_kind) + .018)
var transform := Transform3D(Basis(Vector3.UP, -int(record.quarter) * PI/2), center)
var paths: Array = lib.catalog[record.kind].upperPaths
var branch := 0
if paths.size() > 1:
# The click chooses a Y-merge branch. Its spawn point stays fixed.
var local_hit: Vector3 = transform.affine_inverse() * Vector3(hit.position)
var point := Vector2(local_hit.x, local_hit.z)
var best_distance := INF
for path_index in range(paths.size()):
var path: Array = paths[path_index]
for i in range(path.size() - 1):
var a := Vector2(path[i][0], path[i][2])
var b := Vector2(path[i+1][0], path[i+1][2])
var distance := point.distance_squared_to(Geometry2D.get_closest_point_to_segment(point, a, b))
if distance < best_distance:
best_distance = distance
branch = path_index
return transform * lib.ball_on_surface(record.kind, .5, branch)
func pick_ball_position(origin: Vector3,direction: Vector3,hit: Dictionary) -> void:
var candidate: Variant=null
@@ -554,11 +556,7 @@ func pick_ball_position(origin: Vector3,direction: Vector3,hit: Dictionary) -> v
if ball_pick_mode.selected==1:
candidate=Plane(Vector3.UP,ball_cursor.y).intersects_ray(origin,direction)
elif not hit.is_empty():
candidate=ball_position_on_chute(hit)
if candidate==null:
var normal: Vector3=hit.normal
if normal.length_squared()<.001:return
candidate=hit.position+normal.normalized()*(radius+.018)
candidate=ball_position_on_block(hit)
else:
var ground=Plane(Vector3.UP,0).intersects_ray(origin,direction)
if ground!=null:candidate=ground+Vector3.UP*(radius+.018)