feat: 切换至滚动阻力运行模型并更新资产、编辑器与验证
- 物理规则:现行模型仅保留滚动阻力耗能与恢复系数碰撞,风力、空气阻力、静摩擦、动摩擦不再参与运行;确认三球质量 60/330/约890 kg 及水密度、流阻参数 - 定向加速改为真实顶面接触触发的一次性 +5 m/s 速度事件,模型新增渐进式 U 形导槽出口 - 更新球体、滑槽、水/冰/墙、球洞模型与 storybook 目录、物理、实体配置 - 工坊摆放、编辑器、运行适配与检查脚本同步;删除过时的 baseline 三组检查 - 新增谜题设计参考文档、关卡草稿与本轮实验产物
This commit is contained in:
@@ -7,6 +7,25 @@ const SPEED_GAIN := 5.0
|
||||
var active: Dictionary = {}
|
||||
var events: Array = []
|
||||
|
||||
# Keep the solid cube under the guide. A vertical pick on the centreline can
|
||||
# otherwise pass between the two mirrored triangle strips at some rotations.
|
||||
static func guide_shape(mesh: Mesh, top: float) -> ConcavePolygonShape3D:
|
||||
var faces := mesh.get_faces()
|
||||
var raised := PackedVector3Array()
|
||||
var cut := Plane(Vector3.DOWN,-top)
|
||||
for i in range(0,faces.size(),3):
|
||||
var triangle := faces.slice(i,i+3)
|
||||
if maxf(triangle[0].y,maxf(triangle[1].y,triangle[2].y)) <= top+.00001:continue
|
||||
var polygon := Geometry3D.clip_polygon(triangle,cut)
|
||||
for j in range(1,polygon.size()-1):
|
||||
raised.append(polygon[0])
|
||||
raised.append(polygon[j])
|
||||
raised.append(polygon[j+1])
|
||||
var shape := ConcavePolygonShape3D.new()
|
||||
shape.backface_collision = true
|
||||
shape.set_faces(raised)
|
||||
return shape
|
||||
|
||||
func integrate(state: PhysicsDirectBodyState3D, radius: float) -> void:
|
||||
var touching: Dictionary = {}
|
||||
for i in range(state.get_contact_count()):
|
||||
@@ -19,7 +38,8 @@ func integrate(state: PhysicsDirectBodyState3D, radius: float) -> void:
|
||||
var normal := (state.transform.origin - contact).normalized()
|
||||
var local: Vector3 = block.to_local(contact)
|
||||
var bounds: AABB = block.get_meta("boost_bounds")
|
||||
if normal.y < .9 or absf(local.y - bounds.end.y) > .025:continue
|
||||
var rise := float(block.get_meta("outlet_rise",0.0))
|
||||
if normal.y < .9 or local.y < bounds.end.y-.025 or local.y > bounds.end.y+rise+.025:continue
|
||||
touching[block.get_instance_id()] = block
|
||||
for id in active.keys():
|
||||
if touching.has(id):continue
|
||||
@@ -27,8 +47,10 @@ func integrate(state: PhysicsDirectBodyState3D, radius: float) -> void:
|
||||
if not is_instance_valid(block):active.erase(id);continue
|
||||
var local: Vector3 = block.to_local(state.transform.origin)
|
||||
var bounds: AABB = block.get_meta("boost_bounds")
|
||||
if local.x < bounds.position.x-.025 or local.x > bounds.end.x+.025 or local.z < bounds.position.z-.025 or local.z > bounds.end.z+.025 or absf(local.y-bounds.end.y-radius) > .06:
|
||||
active.erase(id)
|
||||
var rise := float(block.get_meta("outlet_rise",0.0))
|
||||
# The sphere can straddle the mouth after its centre leaves the tile.
|
||||
var guide := AABB(Vector3(bounds.position.x,bounds.end.y,bounds.position.z),Vector3(bounds.size.x,rise,bounds.size.z))
|
||||
if not guide.grow(radius+.025).has_point(local):active.erase(id)
|
||||
# Stable order for the rare case of simultaneously touching two top faces.
|
||||
var blocks: Array = touching.values()
|
||||
blocks.sort_custom(func(a,b):return str(a.get_meta("record_id",a.name)) < str(b.get_meta("record_id",b.name)))
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,61 @@
|
||||
"""Author the launcher's permanent outlet with the straight chute's mouth profile."""
|
||||
from math import cos, pi, sin
|
||||
|
||||
|
||||
def build_outlet(radius, mesh_object, outline, mats):
|
||||
# The last cross-section uses the same 32 facets as the adjoining chute.
|
||||
groove = [(radius * sin(i*pi/32), radius * (1-cos(i*pi/32))) for i in range(-16, 17)]
|
||||
profile = [(-.5, radius), *groove, (.5, radius)]
|
||||
|
||||
start = -.375
|
||||
|
||||
def rise(x, depth):
|
||||
u = min(1, max(0, (x-start)/(.5-start)))
|
||||
return depth * u*u*(3-2*u)
|
||||
|
||||
vertices, faces = [], []
|
||||
for i in range(25):
|
||||
x = -.5+i/24
|
||||
ring = [(x, y, 1+rise(x, depth)) for y, depth in profile]
|
||||
vertices.extend([*ring, (x,.5,0), (x,-.5,0)])
|
||||
width = len(profile)+2
|
||||
for row in range(24):
|
||||
for col in range(width):
|
||||
a = row*width+col
|
||||
b = row*width+(col+1)%width
|
||||
faces.append((a,b,b+width,a+width))
|
||||
# Blender triangulates the concave end caps on export.
|
||||
faces.extend([tuple(reversed(range(width))), tuple(range(24*width,25*width))])
|
||||
body = mesh_object('directional_boost',vertices,faces)
|
||||
for key in ['wall','wall_top']:
|
||||
body.data.materials.append(mats[key])
|
||||
for face in body.data.polygons:
|
||||
face.material_index = int(face.normal.z>0.001)
|
||||
group = [body,outline(body)]
|
||||
|
||||
# Sample the graphic along the same cross-section so it lies on the wood.
|
||||
for suffix,scale,lift,color in [('border',1,.003,'ink'),('fill',.82,.005,'red')]:
|
||||
verts, polys = [], []
|
||||
# Separate bands at the arrow shoulders to keep their sharp corners.
|
||||
for low,high,shaft in [(-.28,-.12,False),(-.12,.12,True),(.12,.28,False)]:
|
||||
cuts = [(low*scale,None),*((y,d) for y,d in groove if low*scale < y < high*scale),(high*scale,None)]
|
||||
for y, depth in cuts:
|
||||
if depth is None:
|
||||
for (ya,da),(yb,db) in zip(groove,groove[1:]):
|
||||
if ya<=y<=yb:
|
||||
depth=da+(db-da)*(y-ya)/(yb-ya)
|
||||
break
|
||||
left = (-.34 if shaft else .04)*scale
|
||||
right = .36*scale-.32*abs(y)/.28
|
||||
for j in range(9):
|
||||
x=left+(right-left)*j/8
|
||||
verts.append((x,y,1+rise(x,depth)+lift))
|
||||
band_start=len(verts)-9*len(cuts)
|
||||
for i in range(len(cuts)-1):
|
||||
for j in range(8):
|
||||
a=band_start+9*i+j
|
||||
polys.append((a,a+1,a+10,a+9))
|
||||
arrow=mesh_object('ink_boost_arrow_'+suffix,verts,polys)
|
||||
arrow.data.materials.append(mats[color])
|
||||
group.append(arrow)
|
||||
return group
|
||||
Reference in New Issue
Block a user