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
+1 -1
View File
@@ -22,7 +22,7 @@
三种球的第一版风格化材质使用同一平滑球面与 1024×512 的颜色和粗糙度贴图。铁球以 Metal 032 的冷灰缎面和 Metal 009 的细磨痕为参考。陶瓷球用白瓷釉色与 Porcelain 001 的钴蓝弧纹。木球结合 Wood 092 的暖木面与 DeadKir 的宽木纹。原始图像和 CC0 授权见 [参考库](../references/materials/ball-materials/README.md)。[Godot 改造前后对比](balls/shared/previews/material-style-v1/comparison.png)上、下两行使用教学关镜头、光照和同一组三条直槽,顺序是铁球、陶瓷球、木球。
球洞外壳现为与墙壁同材质的 1×1×1 方块,内部保留原有锥面和落球通道,碰撞由实际带孔网格生成。制作入口为 `./scripts/asset.zsh goal_hole`;[外观对照](../playtest/artifacts/styled/goal_block/wall_comparison.png)、[入洞与侧壁专项](../playtest/checks/validate_goal_block.gd)及其[36 项检查结果](../playtest/artifacts/styled/goal_block/physics.json)记录此次修改,完整规则见[方块文档](../references/design/blocks.md#非触发方块)。
球洞外壳现为与墙壁同材质的 1×1×1 方块,内部保留原有锥面和落球通道,碰撞由实际带孔网格生成。制作入口为 `./scripts/asset.zsh goal_hole`;[外观对照](../playtest/artifacts/styled/goal_block/wall_comparison.png)、[入洞与侧壁专项](../playtest/checks/validate_goal_block.gd)及其[检查结果](../playtest/artifacts/styled/goal_block/physics.json)记录此次修改,完整规则见[方块文档](../references/design/blocks.md#非触发方块)。
90°弯槽的现用资源为 [turn_90](chutes/turn_90/README.md)。旧 `turn_cw` / `turn_ccw` 文件仅保留作历史源资产,不在现用目录配置中注册,不再出现在素材菜单;旧制作入口转调统一资源。来源快照保留原名称,制作器显式映射为统一类型。
Binary file not shown.
Binary file not shown.
Binary file not shown.
+43 -48
View File
@@ -13,20 +13,11 @@ var water_drag_force := Vector3.ZERO
var impact_contacts: Dictionary={}
var last_linear_velocity := Vector3.ZERO
var radius: float = 0.3
var drag_coefficient: float = 0.47
var air_density: float = 1.225
var wind_velocity := Vector3.ZERO
var mu_static: float = 0.42
var mu_dynamic: float = 0.32
var rolling_resistance: float = 0.025
var friction_enabled := true
var rolling_enabled := true
var drag_enabled := true
var rolling_force := Vector3.ZERO
var contact_count := 0
var ball_contact_count := 0
var contact_slip := 0.0
var air_force := Vector3.ZERO
var rolling_torque := Vector3.ZERO
var travelled := 0.0
var previous_position := Vector3.ZERO
var tracking_started := false
@@ -46,25 +37,33 @@ func _integrate_forces(state: PhysicsDirectBodyState3D) -> void:
return
contact_count = state.get_contact_count()
ball_contact_count = 0
contact_slip = 0.0
apply_water_forces(state)
var load_force := mass * state.total_gravity + constant_force + buoyancy_force + water_drag_force
var strongest_load := 0.0
var contact_bounce := base_bounce
var support_normal := Vector3.ZERO
var active_pair: Dictionary={}
var impacts: Dictionary={}
active_surface="painted_wood"
for i in range(contact_count):
var collider: Node=state.get_contact_collider_object(i)
if collider is RigidBody3D:ball_contact_count+=1
var surface: String=collider.get_meta("piece_type","") if collider!=null else ""
if surface_pairs.has(surface):
var pair: Dictionary=surface_pairs[surface]
if active_pair.is_empty() or pair.dynamicFriction>active_pair.dynamicFriction:
active_pair=pair;active_surface=surface
# Contact positions are global; the sphere's radial direction is unambiguous.
if collider is RigidBody3D:
ball_contact_count+=1
continue
if not collider is StaticBody3D:continue
var surface: String=collider.get_meta("piece_type","")
var pair: Dictionary = surface_pairs.get(surface,{})
if not pair.is_empty():contact_bounce = float(pair.restitution)
var n := (state.transform.origin - state.get_contact_local_position(i)).normalized()
var relative := state.get_contact_local_velocity_at_position(i) - state.get_contact_collider_velocity_at_position(i)
var slip := relative - n * relative.dot(n)
contact_slip = maxf(contact_slip, slip.length())
var load_on_face := -load_force.dot(n)
if load_on_face > 0.0:
support_normal += n * load_on_face
if load_on_face > strongest_load:
strongest_load = load_on_face
active_pair = pair
active_surface = surface if not active_pair.is_empty() else "painted_wood"
if surface=="ice":
var relative := state.get_contact_local_velocity_at_position(i) - state.get_contact_collider_velocity_at_position(i)
var block: Node=collider
while block!=null and not block.has_method("receive_impact"):block=block.get_parent()
if block!=null:
@@ -72,10 +71,6 @@ func _integrate_forces(state: PhysicsDirectBodyState3D) -> void:
if not impacts.has(id):impacts[id]={"block":block,"impulse":0.0,"approach":0.0}
impacts[id].impulse+=absf(state.get_contact_impulse(i).dot(n))
impacts[id].approach=maxf(impacts[id].approach,maxf(-relative.dot(n),-last_linear_velocity.dot(n)))
if n.dot(Vector3.UP) > 0.15 or (surface=="wall" and (mass*state.total_gravity+constant_force+air_force+buoyancy_force+water_drag_force).dot(n)<-.01):
support_normal += n
# Godot exposes one native friction coefficient. Select a slip-dependent
# coefficient; native contact solver still owns the friction impulse.
for id in impacts:
if not impact_contacts.has(id):
var impact: Dictionary=impacts[id]
@@ -86,12 +81,16 @@ func _integrate_forces(state: PhysicsDirectBodyState3D) -> void:
impact_contacts[id]=true
for id in impact_contacts.keys():
if not impacts.has(id):impact_contacts.erase(id)
var contact_static: float=active_pair.get("staticFriction",mu_static)
var contact_dynamic: float=active_pair.get("dynamicFriction",mu_dynamic)
var contact_rolling: float=active_pair.get("rollingResistance",rolling_resistance)
physics_material_override.friction = (contact_static if contact_slip < 0.035 else contact_dynamic) if friction_enabled else 0.0
physics_material_override.bounce=active_pair.get("restitution",base_bounce)
physics_material_override.bounce=contact_bounce
boost_controller.integrate(state, radius)
apply_rolling_resistance(state,support_normal,load_force,active_pair.get("rollingResistance",rolling_resistance))
last_linear_velocity=state.linear_velocity
if tracking_started:
travelled += state.transform.origin.distance_to(previous_position)
previous_position = state.transform.origin
tracking_started = true
func apply_water_forces(state: PhysicsDirectBodyState3D) -> void:
var water: Dictionary=Water.sample(state.transform.origin,radius,get_tree().get_nodes_in_group("water_blocks"))
submerged_fraction=water.fraction;water_velocity=water.velocity
var volume:=4.0/3.0*PI*radius*radius*radius*submerged_fraction
@@ -102,21 +101,17 @@ func _integrate_forces(state: PhysicsDirectBodyState3D) -> void:
var drag_limit:=relative_water.length()*mass/state.step
if water_drag_force.length()>drag_limit:water_drag_force=water_drag_force.normalized()*drag_limit
state.apply_central_force(buoyancy_force+water_drag_force)
var relative_air := state.linear_velocity - wind_velocity
air_force = -0.5 * air_density * drag_coefficient * PI * radius * radius * relative_air.length() * relative_air * (1.0-submerged_fraction) if drag_enabled else Vector3.ZERO
state.apply_central_force(air_force)
rolling_torque = Vector3.ZERO
if rolling_enabled and support_normal.length_squared() > 0.001:
var n := support_normal.normalized()
var roll := state.angular_velocity - n * state.angular_velocity.dot(n)
if roll.length() > 0.0001:
var support := maxf(0.0, -(mass * state.total_gravity + constant_force + air_force + buoyancy_force + water_drag_force).dot(n))
var moment := 0.4 * mass * radius * radius
var limit := roll.length() * moment / state.step
rolling_torque = -roll.normalized() * minf(contact_rolling * support * radius, limit)
state.apply_torque(rolling_torque)
last_linear_velocity=state.linear_velocity
if tracking_started:
travelled += state.transform.origin.distance_to(previous_position)
previous_position = state.transform.origin
tracking_started = true
func apply_rolling_resistance(state: PhysicsDirectBodyState3D, support_normal: Vector3, load_force: Vector3, coefficient: float) -> void:
rolling_force = Vector3.ZERO
if support_normal.length_squared() > 0.0:
var normal := support_normal.normalized()
var tangent := state.linear_velocity.slide(normal)
if rolling_enabled and not tangent.is_zero_approx():
var load_n := maxf(0.0,-load_force.dot(normal))
# One equivalent force per ball, even on a groove or a tile seam.
var magnitude := minf(coefficient * load_n, mass * tangent.length() / state.step)
rolling_force = -tangent.normalized() * magnitude
state.apply_central_force(rolling_force)
# Show rolling from the travelled speed without a tangential contact impulse.
state.angular_velocity = normal.cross(tangent) / radius + normal * state.angular_velocity.dot(normal)
Binary file not shown.
Binary file not shown.
+25 -3
View File
@@ -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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+35 -34
View File
@@ -2035,7 +2035,7 @@
"directional_boost": {
"role": "boost",
"category": "interactive",
"collisionShape": "box",
"collisionShape": "guidedBase",
"cellFootprint": [
1,
1
@@ -2049,19 +2049,20 @@
"max": [
0.5,
0.5,
1
1.32
],
"size": [
1,
1,
1
1.32
]
},
"declaredSize": [
1,
1,
1
1.32
],
"baseHeight": 1,
"geometryOrigin": "authored",
"arrowDirectionGodot": [
1,
@@ -2071,36 +2072,6 @@
"path": "res://assets/blocks/directional_boost/model.glb",
"sourceBlend": "assets/blocks/directional_boost/source/model.blend"
},
"wood_ball": {
"path": "res://assets/balls/wood_ball/model.glb",
"radius": 0.3,
"boundsBlender": {
"size": [
0.6,
0.6,
0.6
]
},
"albedoTexture": "res://assets/balls/wood_ball/textures/albedo.png",
"sourceBlend": "assets/balls/wood_ball/source/model.blend",
"role": "ball",
"geometrySource": "iron_ball"
},
"ceramic_ball": {
"path": "res://assets/balls/ceramic_ball/model.glb",
"radius": 0.3,
"boundsBlender": {
"size": [
0.6,
0.6,
0.6
]
},
"albedoTexture": "res://assets/balls/ceramic_ball/textures/albedo.png",
"sourceBlend": "assets/balls/ceramic_ball/source/model.blend",
"role": "ball",
"geometrySource": "iron_ball"
},
"water": {
"role": "water",
"category": "nonInteractive",
@@ -2173,6 +2144,36 @@
"geometryOrigin": "authored",
"path": "res://assets/blocks/ice/model.glb",
"sourceBlend": "assets/blocks/ice/source/model.blend"
},
"wood_ball": {
"path": "res://assets/balls/wood_ball/model.glb",
"radius": 0.3,
"boundsBlender": {
"size": [
0.6,
0.6,
0.6
]
},
"albedoTexture": "res://assets/balls/wood_ball/textures/albedo.png",
"sourceBlend": "assets/balls/wood_ball/source/model.blend",
"role": "ball",
"geometrySource": "iron_ball"
},
"ceramic_ball": {
"path": "res://assets/balls/ceramic_ball/model.glb",
"radius": 0.3,
"boundsBlender": {
"size": [
0.6,
0.6,
0.6
]
},
"albedoTexture": "res://assets/balls/ceramic_ball/textures/albedo.png",
"sourceBlend": "assets/balls/ceramic_ball/source/model.blend",
"role": "ball",
"geometrySource": "iron_ball"
}
},
"styleFamily": "railbound_inspired",
+1 -1
View File
@@ -28,4 +28,4 @@
"assetId": "water"
}
]
}
}
+2 -4
View File
@@ -164,10 +164,8 @@
],
"notes": [
"Game tuning: all balls have the same authored radius and shape. Wood mass 60 kg; ceramic 330 kg (confirmed initial mass, sinks and travels less than 2 m in the 8-second reference current); iron keeps its original 890.076 kg.",
"Air drag coefficients are gameplay parameters, not measured material constants: wood 0.47, ceramic 0.04, iron 0.47. Iron receives aerodynamic force through the same equation as other balls; its mass and ordinary contact resistance limit motion in the reference wind.",
"No extra fan multiplier or direct wind velocity override. All types use the established contact coefficients to isolate mass and aerodynamic differences.",
"The current native per-body friction/restitution approximation is retained; simultaneous mixed contact-pair solving is not introduced by this asset change.",
"Wall contacts use high friction and rolling resistance; ice uses low friction and rolling resistance. These are shared surface tuning, never per-level ball overrides."
"All balls use gravity, normal collisions, buoyancy and water drag. Solid contact dissipates through rollingResistance only. Air and native contact friction are disabled. dragCoefficient, airDensity, staticFriction and dynamicFriction are retained as historical configuration fields.",
"Rolling resistance coefficients are shared by the three ball types for each surface. Ice has low rolling resistance and walls have high rolling resistance."
],
"airDensity": 1.225
}
+10 -18
View File
@@ -102,7 +102,7 @@ def build_wall(name='wall'):
faces=[(0,2,3,1),(4,5,7,6),(0,1,5,4),(2,6,7,3),(0,4,6,2),(1,3,7,5)]
return mesh_object(name,vertices,faces)
build_funnel();build_wall();build_wall('directional_boost');build_wall('water');build_wall('ice')
build_funnel();build_wall();build_wall('water');build_wall('ice')
mats['water']=mat('water','74C7D8',roughness=.25)
mats['water_surface']=mat('water_surface','63B8C5',roughness=.25)
mats['ice']=mat('ice','A8DAE0',roughness=.12)
@@ -121,9 +121,10 @@ catalog['models']['water']['flowDirectionGodot']=[1,0,0]
catalog['models']['wall']={'role':'solid','category':'nonInteractive','collisionShape':'box',
'cellFootprint':[1,1],'boundsBlender':{'min':[-.5,-.5,0],'max':[.5,.5,1],'size':[1,1,1]},
'declaredSize':[1,1,1],'geometryOrigin':'authored'}
catalog['models']['directional_boost']={'role':'boost','category':'interactive','collisionShape':'box',
'cellFootprint':[1,1],'boundsBlender':{'min':[-.5,-.5,0],'max':[.5,.5,1],'size':[1,1,1]},
'declaredSize':[1,1,1],'geometryOrigin':'authored','arrowDirectionGodot':[1,0,0]}
boost_radius=catalog['models']['straight']['grooveRadius']
catalog['models']['directional_boost']={'role':'boost','category':'interactive','collisionShape':'guidedBase',
'cellFootprint':[1,1],'boundsBlender':{'min':[-.5,-.5,0],'max':[.5,.5,1+boost_radius],'size':[1,1,1+boost_radius]},
'declaredSize':[1,1,1+boost_radius],'baseHeight':1,'geometryOrigin':'authored','arrowDirectionGodot':[1,0,0]}
catalog['models']['goal_hole']={'role':'goal','category':'nonInteractive','openingRadius':.32,
'entranceRadius':.46,'funnelDepth':.35,'depth':1.0,'cellFootprint':[1,1],
'boundsBlender':{'min':[-.5,-.5,-1],'max':[.5,.5,0],'size':[1,1,1]},
@@ -160,17 +161,6 @@ def outline(obj):
bm.free()
return lines(obj.name,segments)
def boost_arrow():
# Flat authored graphic above the top face; excluded from collision like ink outlines.
points=[(-.34,-.12),(.04,-.12),(.04,-.28),(.36,0),(.04,.28),(.04,.12),(-.34,.12)]
result=[]
for suffix,scale,z,color in [('border',1,1.002,'ink'),('fill',.82,1.003,'red')]:
arrow=mesh_object('ink_boost_arrow_'+suffix,[(x*scale,y*scale,z) for x,y in points],[tuple(range(7))])
arrow.data.materials.append(mats[color]);arrow['visual_only']=True
result.append(arrow)
return result
def asset_dir(kind):
category = 'balls' if kind == 'iron_ball' else 'goals' if kind == 'goal_hole' else 'blocks' if kind in ('wall','directional_boost','water','ice') else 'chutes'
return ROOT / 'assets' / category / kind
@@ -186,6 +176,9 @@ groups=[];report=[]
all_kinds=kinds+['iron_ball','goal_hole','wall','directional_boost','water','ice']
if ONLY_ASSET is not None and ONLY_ASSET not in all_kinds:raise ValueError(ONLY_ASSET)
for kind in ([ONLY_ASSET] if ONLY_ASSET else all_kinds):
if kind=='directional_boost':
author=runpy.run_path(str(asset_dir(kind)/'source/outlet.py'))
group=author['build_outlet'](boost_radius,mesh_object,outline,mats)
obj=bpy.data.objects[snapshot_turn if kind=='turn_90' else kind]
if kind=='turn_90':
obj.name=kind
@@ -194,7 +187,7 @@ for kind in ([ONLY_ASSET] if ONLY_ASSET else all_kinds):
obj.data=obj.data.copy()
before_coords=[tuple(v.co) for v in obj.data.vertices]
old_indices=[p.material_index for p in obj.data.polygons]
obj.data.materials.clear()
if kind!='directional_boost':obj.data.materials.clear()
if kind in kinds:
for key in ['body','groove','top']:obj.data.materials.append(mats[key])
for face,old in zip(obj.data.polygons,old_indices):
@@ -228,11 +221,10 @@ for kind in ([ONLY_ASSET] if ONLY_ASSET else all_kinds):
ice_style['apply_ice_surface'](obj,mats['ice'],mats['ice_top'])
group.append(outline(obj))
category='entities'
else:
elif kind!='directional_boost':
obj.data.materials.append(mats['wall']);obj.data.materials.append(mats['wall_top'])
for face in obj.data.polygons:face.material_index=1 if face.normal.z>.5 else 0
group=[obj,outline(obj)]
if kind=='directional_boost':group+=boost_arrow()
category='entities'
obj['style_family']='railbound_inspired'
obj['collision_source']='authored mesh' if kind in ('wall','goal_hole','directional_boost','water','ice') else 'unchanged source mesh'
Binary file not shown.
+14 -10
View File
@@ -83,17 +83,21 @@ for kind,data in catalog['models'].items():
if authored:
bm=bmesh.new();bm.from_mesh(obj.data)
volume=abs(bm.calc_volume(signed=True));closed=all(e.is_manifold for e in bm.edges);bm.free()
correct=correct and closed and all(abs(d-1)<1e-6 for d in obj.dimensions)
if kind in ('wall','directional_boost'):
correct=correct and closed and (obj.dimensions-Vector(data['boundsBlender']['size'])).length<1e-6
if kind=='wall':
correct=correct and abs(volume-1)<1e-6
if kind=='directional_boost':
arrow=bpy.data.objects.get('ink_boost_arrow_fill')
correct=correct and arrow is not None
if arrow is not None:
points=[v.co for v in arrow.data.vertices]
tip=max(points,key=lambda v:v.x)
correct=correct and tip.x>0 and abs(tip.y)<1e-6 and all(1<v.z<1.01 for v in points)
check['arrowTipBlender']=list(tip)
elif kind=='directional_boost':
base=data['baseHeight']
radius=catalog['models']['straight']['grooveRadius']
mouth=[v.co for v in obj.data.vertices if abs(v.co.x-.5)<1e-6]
profile=[Vector((.5,radius*math.sin(i*math.pi/32),base+radius*(1-math.cos(i*math.pi/32)))) for i in range(-16,17)]
correct=correct and all(any((vertex-target).length<1e-6 for vertex in mouth) for target in profile)
arrow=bpy.data.objects.get('ink_boost_arrow_fill')
correct=correct and arrow is not None
if arrow is not None:
tip=max((v.co for v in arrow.data.vertices),key=lambda v:v.x)
correct=correct and tip.x>0 and abs(tip.y)<1e-6 and base<tip.z<base+.01
check['arrowTipBlender']=list(tip)
elif kind=='goal_hole':
tree=BVHTree.FromPolygons([v.co for v in obj.data.vertices],
[list(p.vertices) for p in obj.data.polygons])
Binary file not shown.