feat: 切换至滚动阻力运行模型并更新资产、编辑器与验证
- 物理规则:现行模型仅保留滚动阻力耗能与恢复系数碰撞,风力、空气阻力、静摩擦、动摩擦不再参与运行;确认三球质量 60/330/约890 kg 及水密度、流阻参数 - 定向加速改为真实顶面接触触发的一次性 +5 m/s 速度事件,模型新增渐进式 U 形导槽出口 - 更新球体、滑槽、水/冰/墙、球洞模型与 storybook 目录、物理、实体配置 - 工坊摆放、编辑器、运行适配与检查脚本同步;删除过时的 baseline 三组检查 - 新增谜题设计参考文档、关卡草稿与本轮实验产物
This commit is contained in:
@@ -29,10 +29,12 @@ func create_piece(kind: String, location := Vector3.ZERO, quarter := 0) -> Node3
|
||||
if kind == Booster.KIND:
|
||||
root.set_meta("boost_direction", vector(catalog[kind].arrowDirectionGodot))
|
||||
var bounds: Dictionary = catalog[kind].boundsBlender
|
||||
root.set_meta("boost_bounds", AABB(Vector3(bounds.min[0],bounds.min[2],-bounds.max[1]),Vector3(bounds.size[0],bounds.size[2],bounds.size[1])))
|
||||
if not scene_cache.has(kind):
|
||||
scene_cache[kind] = load(catalog[kind]["path"])
|
||||
var visual: Node3D = scene_cache[kind].instantiate()
|
||||
root.set_meta("boost_bounds", AABB(Vector3(bounds.min[0],bounds.min[2],-bounds.max[1]),Vector3(bounds.size[0],catalog[kind].baseHeight,bounds.size[1])))
|
||||
root.set_meta("outlet_rise",float(bounds.size[2])-float(catalog[kind].baseHeight))
|
||||
var path: String = catalog[kind].path
|
||||
if not scene_cache.has(path):
|
||||
scene_cache[path] = load(path)
|
||||
var visual: Node3D = scene_cache[path].instantiate()
|
||||
root.add_child(visual)
|
||||
if kind == "ice":
|
||||
IceAppearance.apply(visual, location)
|
||||
@@ -57,13 +59,24 @@ func add_colliders(node: Node, kind: String) -> void:
|
||||
body.collision_mask = 2
|
||||
body.set_meta("piece_type",kind)
|
||||
var material := PhysicsMaterial.new()
|
||||
material.friction = .25 if kind=="goal_hole" else 1.0 # native pair uses min.
|
||||
material.friction = 0.0
|
||||
material.bounce = 0.0
|
||||
body.physics_material_override = material
|
||||
var collider := CollisionShape3D.new()
|
||||
var use_box: bool = catalog[kind].get("collisionShape","")=="box"
|
||||
var key := kind + ":" + str(node.name)
|
||||
var bounds: Dictionary = catalog[kind].boundsBlender
|
||||
if kind == Booster.KIND:
|
||||
var base := CollisionShape3D.new()
|
||||
var box := BoxShape3D.new()
|
||||
box.size = Vector3(bounds.size[0],catalog[kind].baseHeight,bounds.size[1])
|
||||
base.shape = box
|
||||
base.position.y = float(bounds.min[2])+box.size.y*.5
|
||||
body.add_child(base)
|
||||
if not collision_cache.has(key):
|
||||
if catalog[kind].get("collisionShape","")=="box":
|
||||
if kind == Booster.KIND:
|
||||
collision_cache[key]=Booster.guide_shape(node.mesh,float(catalog[kind].baseHeight))
|
||||
elif use_box:
|
||||
var shape:=BoxShape3D.new()
|
||||
shape.size=node.mesh.get_aabb().size
|
||||
collision_cache[key]=shape
|
||||
@@ -72,7 +85,7 @@ func add_colliders(node: Node, kind: String) -> void:
|
||||
shape.backface_collision = true
|
||||
collision_cache[key] = shape
|
||||
collider.shape = collision_cache[key]
|
||||
if catalog[kind].get("collisionShape","")=="box":collider.position=node.mesh.get_aabb().get_center()
|
||||
if use_box:collider.position=node.mesh.get_aabb().get_center()
|
||||
body.add_child(collider)
|
||||
node.add_child(body)
|
||||
for child in node.get_children():
|
||||
@@ -117,15 +130,11 @@ func create_ball(type_id: String = "iron_ball") -> RigidBody3D:
|
||||
body.radius = float(data["radius"])
|
||||
body.mass = float(profile["massKg"])
|
||||
body.inertia = Vector3.ONE * (0.4 * body.mass * body.radius * body.radius)
|
||||
body.drag_coefficient = float(profile["dragCoefficient"])
|
||||
body.air_density = float(physics["airDensity"])
|
||||
body.mu_static = float(pair["staticFriction"])
|
||||
body.mu_dynamic = float(pair["dynamicFriction"])
|
||||
body.rolling_resistance = float(pair["rollingResistance"])
|
||||
body.collision_layer = 2
|
||||
body.collision_mask = 3
|
||||
var material := PhysicsMaterial.new()
|
||||
material.friction = body.mu_static
|
||||
material.friction = 0.0
|
||||
material.bounce = float(pair["restitution"])
|
||||
body.base_bounce=material.bounce
|
||||
body.physics_material_override = material
|
||||
@@ -158,7 +167,7 @@ func create_box(size: Vector3, location: Vector3, color: Color, solid := true) -
|
||||
root.collision_layer = 1
|
||||
root.collision_mask = 2
|
||||
var pm := PhysicsMaterial.new()
|
||||
pm.friction = 1.0
|
||||
pm.friction = 0.0
|
||||
root.physics_material_override = pm
|
||||
return root
|
||||
|
||||
@@ -201,7 +210,8 @@ func create_goal_hole(location: Vector3) -> Node3D:
|
||||
return create_piece("goal_hole",location)
|
||||
|
||||
func crossed_goal(previous: Vector3, current: Vector3, goal: Vector3, radius: float) -> bool:
|
||||
var height: float=goal.y-float(catalog["goal_hole"].depth)
|
||||
# Score at the entrance to the narrow throat, including when a block closes the exit.
|
||||
var height: float=goal.y-float(catalog["goal_hole"].funnelDepth)
|
||||
if previous.y<=height or current.y>height:return false
|
||||
var ratio: float=(previous.y-height)/maxf(previous.y-current.y,.000001)
|
||||
var crossing: Vector3=previous.lerp(current,ratio)
|
||||
|
||||
Reference in New Issue
Block a user