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
+12 -68
View File
@@ -5,7 +5,6 @@ var results: Array=[]
var failures:=0
var app
var demo
var wind_measurements: Dictionary={}
func _initialize() -> void: call_deferred("run")
func check(name: String, ok: bool, detail: Dictionary={}) -> void:
@@ -84,7 +83,7 @@ func run() -> void:
var correct:=false
if not event.is_empty():
var before: Vector3=event.before;var after: Vector3=event.after
var expected:=direction*(Vector2(before.x,before.z).length()+5)
var expected: Vector3=direction*(Vector2(before.x,before.z).length()+app.Booster.SPEED_GAIN)
correct=Vector3(after.x,0,after.z).distance_to(expected)<.0001 and is_equal_approx(before.y,after.y)
var pos: Vector3=body.position
await frames(8)
@@ -114,75 +113,20 @@ func run() -> void:
for kind in TYPES:
check("roll_into_hole_%s_run%d"%[kind,attempt+1],demo.events.any(func(event):return event.ballId==kind),{"events":demo.events})
check("roll_three_unique_goal_events_run%d"%(attempt+1),demo.entered.size()==3 and demo.events.size()==3 and demo.lost.is_empty())
for with_wind in [false,true]:
demo.load_mode("wind");await frames(3)
for body in demo.balls:body.wind_velocity=Vector3(20,0,0) if with_wind else Vector3.ZERO
var peaks: Array=[0.0,0.0,0.0]
demo.toggle_run()
for frame in range(600):
await physics_frame
for i in range(3):peaks[i]=maxf(peaks[i],demo.balls[i].air_force.length())
var measurements: Dictionary={}
for i in range(3):
var body=demo.balls[i]
measurements[TYPES[i]]={"dx":body.position.x-demo.spawn_specs[i].position[0],"speed":body.linear_velocity.length(),"peakAirForceN":peaks[i]}
wind_measurements["wind" if with_wind else "calm"]=measurements
var wood_delta: float=wind_measurements.wind.wood_ball.dx-wind_measurements.calm.wood_ball.dx
var ceramic_delta: float=wind_measurements.wind.ceramic_ball.dx-wind_measurements.calm.ceramic_ball.dx
var iron_delta: float=wind_measurements.wind.iron_ball.dx-wind_measurements.calm.iron_ball.dx
check("wind_clearly_moves_wood",wood_delta>1.0,{"windMinusCalmMeters":wood_delta})
check("ceramic_weak_wind_response",ceramic_delta>=-.001 and ceramic_delta<.2 and ceramic_delta<wood_delta*.15,{"windMinusCalmMeters":ceramic_delta})
check("iron_receives_nonzero_wind_force",wind_measurements.wind.iron_ball.peakAirForceN>30 and wind_measurements.wind.iron_ball.peakAirForceN<35,
{"peakAirForceN":wind_measurements.wind.iron_ball.peakAirForceN})
check("heavy_iron_barely_moves_in_reference_wind",absf(iron_delta)<.1 and absf(iron_delta)<wood_delta*.1,
{"windMinusCalmMeters":iron_delta,"maxDisplacementMeters":.1})
# The same physical iron must move when a sufficiently stronger wind acts.
demo.load_mode("wind");await frames(3)
for body in demo.balls:body.wind_velocity=Vector3.ZERO
var iron=demo.balls[2];iron.wind_velocity=Vector3(100,0,0)
var start_x: float=iron.position.x
demo.toggle_run();await frames(360)
check("strong_wind_can_move_iron",iron.position.x-start_x>.5 and iron.air_force.x>0,
{"windSpeedMps":100,"durationSeconds":3,"displacementMeters":iron.position.x-start_x,"airForceN":iron.air_force.x})
root.remove_child(demo);demo.queue_free();await process_frame
# Isolate mass with two otherwise identical iron bodies in free space.
# No drag override: this tests the actual configured iron profile.
var heavy=lib.create_ball("iron_ball")
var light=lib.create_ball("iron_ball")
var calm=lib.create_ball("iron_ball")
light.mass=heavy.mass/10
light.inertia=Vector3.ONE*(.4*light.mass*light.radius*light.radius)
var bodies=[heavy,light,calm]
for i in range(3):
var body=bodies[i]
body.freeze=true;body.gravity_scale=0;root.add_child(body);body.position=Vector3(0,10,i*3)
body.wind_velocity=Vector3(20,0,0) if i<2 else Vector3.ZERO
await frames(3)
check("iron_profile_has_normal_air_drag",heavy.drag_enabled and is_equal_approx(heavy.drag_coefficient,.47) and
is_equal_approx(heavy.drag_coefficient,lib.physics.physicsProfiles.wood_game.dragCoefficient))
for body in bodies:body.freeze=false
calm.linear_velocity=Vector3(2,0,0)
await frames(2)
var forces: Array=[heavy.air_force.x,light.air_force.x]
await frames(118)
var k: float=.5*heavy.air_density*heavy.drag_coefficient*PI*heavy.radius*heavy.radius
var expected_force: float=k*20*20
check("mass_does_not_change_initial_wind_force",forces[0]>0 and absf(forces[0]-expected_force)<.1 and absf(forces[1]-expected_force)<.1,
{"heavyLightForceN":forces,"analyticForceN":expected_force})
# dv/dt = k/m * (u-v)^2, v(0)=0, integrated for one second.
for body in [heavy,light]:
var expected_speed: float=20.0-20.0/(1.0+k/body.mass*20.0)
check("wind_motion_matches_equation_mass_"+str(body.mass),absf(body.linear_velocity.x-expected_speed)<maxf(.0005,expected_speed*.02),
{"massKg":body.mass,"speedMps":body.linear_velocity.x,"analyticSpeedMps":expected_speed})
check("lower_mass_increases_wind_acceleration",heavy.linear_velocity.x>.02 and light.linear_velocity.x>heavy.linear_velocity.x*9,
{"heavyLightSpeedsMps":[heavy.linear_velocity.x,light.linear_velocity.x]})
check("iron_still_air_drag_is_active",calm.air_force.dot(calm.linear_velocity)<0 and calm.linear_velocity.x<1.9999,
{"speedMps":calm.linear_velocity.x,"airForceX":calm.air_force.x})
for body in bodies:root.remove_child(body);body.queue_free()
await process_frame
# All production profiles keep their horizontal speed during free flight.
for kind in TYPES:
var body=lib.create_ball(kind)
root.add_child(body);body.position=Vector3(0,40,0)
body.linear_velocity=Vector3(4,0,0)
await physics_frame
var initial:Vector3=body.linear_velocity
await frames(120)
var delta:Vector3=body.linear_velocity-initial
check("gravity_only_in_air_"+kind,absf(delta.x)<.001 and absf(delta.y+9.81)<.02 and body.rolling_force.is_zero_approx() and body.physics_material_override.friction==0.0,{"velocity_change_1s":delta})
root.remove_child(body);body.queue_free()
var file:=FileAccess.open("res://playtest/artifacts/styled/ball_materials_report.json",FileAccess.WRITE)
file.store_string(JSON.stringify({"engine":Engine.get_version_info().string,"physicsHz":120,
"windSpeedMps":20,"windDurationSeconds":5,"windComparisons":wind_measurements,
"passed":results.size()-failures,"failed":failures,"results":results}," "));file.close()
print("BALL_MATERIALS_REPORT ",results.size()-failures," passed, ",failures," failed")
quit(1 if failures else 0)