feat: 建立关卡工坊并整理项目目录
- 加入 Godot 基础试玩、画风展示和通孔验证场景 - 支持自由放球、多层叠放、墙壁、锥口球洞及固定 +5 m/s 定向加速方块 - 保存 Blender 源资产、模型导出、资源制作脚本和关卡编辑存档逻辑 - 按七类目录归档工程,集中 zsh 启动入口并补充 AGENTS.md 文件索引 - 同步设计规则、依赖锁定、验证报告和目录迁移记录 验证:目录迁移后的资源导入与四个场景加载通过;本次提交前检查暂存内容,未重复运行整套物理测试。
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# 游戏资产
|
||||
|
||||
按 **资源类型 / 资源名** 组织;模型、源文件和制作入口位于同一资源目录。
|
||||
|
||||
| 类型 | 资源 |
|
||||
| --- | --- |
|
||||
| [chutes](chutes) | 直行、两种拐弯、缓坡、陡坡、Y 汇流。 |
|
||||
| [balls](balls) | 铁球模型及物理行为。 |
|
||||
| [blocks](blocks) | 标准墙壁、定向加速方块。 |
|
||||
| [goals](goals) | 锥口球洞。 |
|
||||
| [collections](collections) | 基础集合与当前画风集合的共享制作代码、参数、整套源文件和快照。 |
|
||||
|
||||
`model.glb` 用于运行;`source/model.blend` 用于编辑,`source/build.py` 是制作入口;`baseline/model.glb` 为早期变体。`source/.gdignore` 使 Godot 跳过制作源文件。
|
||||
|
||||
例如定向加速方块:[模型](blocks/directional_boost/model.glb)、[源文件](blocks/directional_boost/source/model.blend)、[制作入口](blocks/directional_boost/source/build.py)、[行为](blocks/directional_boost/behavior.gd)。
|
||||
|
||||
从根目录运行 `./scripts/asset.zsh directional_boost` 可制作指定资源;`all` 制作当前画风整套,`baseline` 制作基础整套。单资源入口复用集合代码,只导出目标资源。参数化重建会重新生成相应源文件,手工修改模型后先决定是否继续使用生成器。
|
||||
|
||||
当前资产目录:[catalog.json](collections/storybook/catalog.json);物理参数:[physics.json](collections/storybook/physics.json);实体分类:[entities.json](collections/storybook/entities.json)。[来源快照](collections/storybook/source/snapshot) 是生成输入,不是可随意删除的缓存。
|
||||
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://bqbwiuklxhu3m"
|
||||
path="res://.godot/imported/model.glb-5e055581ba61e2c0c52215a9c57579de.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/balls/iron_ball/baseline/model.glb"
|
||||
dest_files=["res://.godot/imported/model.glb-5e055581ba61e2c0c52215a9c57579de.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
mesh_library/use_node_names_as_mesh_names=false
|
||||
array_mesh/deduplicate_surfaces=true
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
gltf/texture_map_mode=1
|
||||
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://u75pywkqa11i"
|
||||
path="res://.godot/imported/model.glb-84ea59e03d48e9c4a39ea66137920174.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/balls/iron_ball/model.glb"
|
||||
dest_files=["res://.godot/imported/model.glb-84ea59e03d48e9c4a39ea66137920174.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
mesh_library/use_node_names_as_mesh_names=false
|
||||
array_mesh/deduplicate_surfaces=true
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
gltf/texture_map_mode=1
|
||||
@@ -0,0 +1,70 @@
|
||||
extends RigidBody3D
|
||||
|
||||
const Booster = preload("res://assets/blocks/directional_boost/behavior.gd")
|
||||
var boost_controller = Booster.new()
|
||||
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 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
|
||||
|
||||
func _ready() -> void:
|
||||
continuous_cd = true
|
||||
contact_monitor = true
|
||||
max_contacts_reported = 12
|
||||
can_sleep = false
|
||||
linear_damp_mode = RigidBody3D.DAMP_MODE_REPLACE
|
||||
angular_damp_mode = RigidBody3D.DAMP_MODE_REPLACE
|
||||
linear_damp = 0.0
|
||||
angular_damp = 0.0
|
||||
|
||||
func _integrate_forces(state: PhysicsDirectBodyState3D) -> void:
|
||||
if freeze:
|
||||
return
|
||||
contact_count = state.get_contact_count()
|
||||
ball_contact_count = 0
|
||||
contact_slip = 0.0
|
||||
var support_normal := Vector3.ZERO
|
||||
for i in range(contact_count):
|
||||
if state.get_contact_collider_object(i) is RigidBody3D:ball_contact_count+=1
|
||||
# Contact positions are global; the sphere's radial direction is unambiguous.
|
||||
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())
|
||||
if n.dot(Vector3.UP) > 0.15:
|
||||
support_normal += n
|
||||
# Godot exposes one native friction coefficient. Select a slip-dependent
|
||||
# coefficient; native contact solver still owns the friction impulse.
|
||||
physics_material_override.friction = (mu_static if contact_slip < 0.035 else mu_dynamic) if friction_enabled else 0.0
|
||||
boost_controller.integrate(state, radius)
|
||||
var relative_air := state.linear_velocity - wind_velocity
|
||||
air_force = -0.5 * air_density * drag_coefficient * PI * radius * radius * relative_air.length() * relative_air 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 + air_force).dot(n))
|
||||
var moment := 0.4 * mass * radius * radius
|
||||
var limit := roll.length() * moment / state.step
|
||||
rolling_torque = -roll.normalized() * minf(rolling_resistance * support * radius, limit)
|
||||
state.apply_torque(rolling_torque)
|
||||
if tracking_started:
|
||||
travelled += state.transform.origin.distance_to(previous_position)
|
||||
previous_position = state.transform.origin
|
||||
tracking_started = true
|
||||
@@ -0,0 +1 @@
|
||||
uid://ieaoae3mjv03
|
||||
@@ -0,0 +1,8 @@
|
||||
"""Rebuild only this resource using the shared collection authoring code."""
|
||||
from pathlib import Path
|
||||
import runpy
|
||||
|
||||
RESOURCE = Path(__file__).resolve().parent.parent.name
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
runpy.run_path(str(ROOT / 'assets/collections/storybook/source/build.py'),
|
||||
init_globals={'ONLY_ASSET': RESOURCE}, run_name='__main__')
|
||||
Binary file not shown.
@@ -0,0 +1,46 @@
|
||||
extends RefCounted
|
||||
|
||||
const KIND := "directional_boost"
|
||||
const SPEED_GAIN := 5.0
|
||||
|
||||
# One latch per ball and block. A small separation margin tolerates contact jitter.
|
||||
var active: Dictionary = {}
|
||||
var events: Array = []
|
||||
|
||||
func integrate(state: PhysicsDirectBodyState3D, radius: float) -> void:
|
||||
var touching: Dictionary = {}
|
||||
for i in range(state.get_contact_count()):
|
||||
var collider: Node = state.get_contact_collider_object(i)
|
||||
if collider == null or collider.get_meta("piece_type", "") != KIND:continue
|
||||
var block: Node = collider
|
||||
while block != null and not block.has_meta("boost_bounds"):block = block.get_parent()
|
||||
if block == null:continue
|
||||
var contact: Vector3 = state.get_contact_collider_position(i)
|
||||
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
|
||||
touching[block.get_instance_id()] = block
|
||||
for id in active.keys():
|
||||
if touching.has(id):continue
|
||||
var block = active[id]
|
||||
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)
|
||||
# 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)))
|
||||
for block in blocks:
|
||||
var id: int = block.get_instance_id()
|
||||
if active.has(id):continue
|
||||
active[id] = block
|
||||
var before := state.linear_velocity
|
||||
var direction: Vector3 = block.global_basis * Vector3(block.get_meta("boost_direction"))
|
||||
direction.y = 0;direction = direction.normalized()
|
||||
var speed := Vector2(before.x,before.z).length() + SPEED_GAIN
|
||||
var after := direction * speed
|
||||
after.y = before.y
|
||||
state.linear_velocity = after
|
||||
events.append({"blockId":str(block.get_meta("record_id",block.name)),"before":before,"after":after,"tick":Engine.get_physics_frames()})
|
||||
@@ -0,0 +1 @@
|
||||
uid://bkojodf5an6c
|
||||
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://ctugu4qe5hoes"
|
||||
path="res://.godot/imported/model.glb-3291d7d4697a980d05594124bc8e18d7.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/blocks/directional_boost/model.glb"
|
||||
dest_files=["res://.godot/imported/model.glb-3291d7d4697a980d05594124bc8e18d7.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
mesh_library/use_node_names_as_mesh_names=false
|
||||
array_mesh/deduplicate_surfaces=true
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
gltf/texture_map_mode=1
|
||||
@@ -0,0 +1,8 @@
|
||||
"""Rebuild only this resource using the shared collection authoring code."""
|
||||
from pathlib import Path
|
||||
import runpy
|
||||
|
||||
RESOURCE = Path(__file__).resolve().parent.parent.name
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
runpy.run_path(str(ROOT / 'assets/collections/storybook/source/build.py'),
|
||||
init_globals={'ONLY_ASSET': RESOURCE}, run_name='__main__')
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://dsvx7y6xfcrhn"
|
||||
path="res://.godot/imported/model.glb-e70e20d2f6a47b149d655452336f7d1c.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/blocks/wall/model.glb"
|
||||
dest_files=["res://.godot/imported/model.glb-e70e20d2f6a47b149d655452336f7d1c.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
mesh_library/use_node_names_as_mesh_names=false
|
||||
array_mesh/deduplicate_surfaces=true
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
gltf/texture_map_mode=1
|
||||
@@ -0,0 +1,8 @@
|
||||
"""Rebuild only this resource using the shared collection authoring code."""
|
||||
from pathlib import Path
|
||||
import runpy
|
||||
|
||||
RESOURCE = Path(__file__).resolve().parent.parent.name
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
runpy.run_path(str(ROOT / 'assets/collections/storybook/source/build.py'),
|
||||
init_globals={'ONLY_ASSET': RESOURCE}, run_name='__main__')
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://4sm5aojhi4w6"
|
||||
path="res://.godot/imported/model.glb-30148fc463f54166480e9ba8cd6d2b86.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/chutes/gentle/baseline/model.glb"
|
||||
dest_files=["res://.godot/imported/model.glb-30148fc463f54166480e9ba8cd6d2b86.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
mesh_library/use_node_names_as_mesh_names=false
|
||||
array_mesh/deduplicate_surfaces=true
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
gltf/texture_map_mode=1
|
||||
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://n03eiy33il2p"
|
||||
path="res://.godot/imported/model.glb-9065d1c9f3286b5fbe96b779e9a3e00f.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/chutes/gentle/model.glb"
|
||||
dest_files=["res://.godot/imported/model.glb-9065d1c9f3286b5fbe96b779e9a3e00f.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
mesh_library/use_node_names_as_mesh_names=false
|
||||
array_mesh/deduplicate_surfaces=true
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
gltf/texture_map_mode=1
|
||||
@@ -0,0 +1,8 @@
|
||||
"""Rebuild only this resource using the shared collection authoring code."""
|
||||
from pathlib import Path
|
||||
import runpy
|
||||
|
||||
RESOURCE = Path(__file__).resolve().parent.parent.name
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
runpy.run_path(str(ROOT / 'assets/collections/storybook/source/build.py'),
|
||||
init_globals={'ONLY_ASSET': RESOURCE}, run_name='__main__')
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://epjlp7an81xf"
|
||||
path="res://.godot/imported/model.glb-112c5cd7a38ef7dc0dc0d0b7a878ac70.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/chutes/steep/baseline/model.glb"
|
||||
dest_files=["res://.godot/imported/model.glb-112c5cd7a38ef7dc0dc0d0b7a878ac70.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
mesh_library/use_node_names_as_mesh_names=false
|
||||
array_mesh/deduplicate_surfaces=true
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
gltf/texture_map_mode=1
|
||||
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://b8wromjqvf3ts"
|
||||
path="res://.godot/imported/model.glb-2d1ec72b64a498d19c6e0bf09de04d98.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/chutes/steep/model.glb"
|
||||
dest_files=["res://.godot/imported/model.glb-2d1ec72b64a498d19c6e0bf09de04d98.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
mesh_library/use_node_names_as_mesh_names=false
|
||||
array_mesh/deduplicate_surfaces=true
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
gltf/texture_map_mode=1
|
||||
@@ -0,0 +1,8 @@
|
||||
"""Rebuild only this resource using the shared collection authoring code."""
|
||||
from pathlib import Path
|
||||
import runpy
|
||||
|
||||
RESOURCE = Path(__file__).resolve().parent.parent.name
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
runpy.run_path(str(ROOT / 'assets/collections/storybook/source/build.py'),
|
||||
init_globals={'ONLY_ASSET': RESOURCE}, run_name='__main__')
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://dh35m1i5jcrl7"
|
||||
path="res://.godot/imported/model.glb-9d61925d33fd2393aeb0ff4916d19c8e.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/chutes/straight/baseline/model.glb"
|
||||
dest_files=["res://.godot/imported/model.glb-9d61925d33fd2393aeb0ff4916d19c8e.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
mesh_library/use_node_names_as_mesh_names=false
|
||||
array_mesh/deduplicate_surfaces=true
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
gltf/texture_map_mode=1
|
||||
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://beylngg07k5gy"
|
||||
path="res://.godot/imported/model.glb-4d0ec11a54c0bb43d31739e394c20e98.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/chutes/straight/model.glb"
|
||||
dest_files=["res://.godot/imported/model.glb-4d0ec11a54c0bb43d31739e394c20e98.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
mesh_library/use_node_names_as_mesh_names=false
|
||||
array_mesh/deduplicate_surfaces=true
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
gltf/texture_map_mode=1
|
||||
@@ -0,0 +1,8 @@
|
||||
"""Rebuild only this resource using the shared collection authoring code."""
|
||||
from pathlib import Path
|
||||
import runpy
|
||||
|
||||
RESOURCE = Path(__file__).resolve().parent.parent.name
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
runpy.run_path(str(ROOT / 'assets/collections/storybook/source/build.py'),
|
||||
init_globals={'ONLY_ASSET': RESOURCE}, run_name='__main__')
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://o5060myig6kq"
|
||||
path="res://.godot/imported/model.glb-2b9ee2beae2e83a5588df2ea7c521130.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/chutes/turn_ccw/baseline/model.glb"
|
||||
dest_files=["res://.godot/imported/model.glb-2b9ee2beae2e83a5588df2ea7c521130.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
mesh_library/use_node_names_as_mesh_names=false
|
||||
array_mesh/deduplicate_surfaces=true
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
gltf/texture_map_mode=1
|
||||
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://dbxxkob8q3w4v"
|
||||
path="res://.godot/imported/model.glb-0089b79a457b3713a90bb539ab3bb695.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/chutes/turn_ccw/model.glb"
|
||||
dest_files=["res://.godot/imported/model.glb-0089b79a457b3713a90bb539ab3bb695.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
mesh_library/use_node_names_as_mesh_names=false
|
||||
array_mesh/deduplicate_surfaces=true
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
gltf/texture_map_mode=1
|
||||
@@ -0,0 +1,8 @@
|
||||
"""Rebuild only this resource using the shared collection authoring code."""
|
||||
from pathlib import Path
|
||||
import runpy
|
||||
|
||||
RESOURCE = Path(__file__).resolve().parent.parent.name
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
runpy.run_path(str(ROOT / 'assets/collections/storybook/source/build.py'),
|
||||
init_globals={'ONLY_ASSET': RESOURCE}, run_name='__main__')
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://udqhm02r1d0h"
|
||||
path="res://.godot/imported/model.glb-f6bb67f1d252bcf9f455b21480ac71bd.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/chutes/turn_cw/baseline/model.glb"
|
||||
dest_files=["res://.godot/imported/model.glb-f6bb67f1d252bcf9f455b21480ac71bd.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
mesh_library/use_node_names_as_mesh_names=false
|
||||
array_mesh/deduplicate_surfaces=true
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
gltf/texture_map_mode=1
|
||||
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://d0h3bueayotgr"
|
||||
path="res://.godot/imported/model.glb-1c5027ed37edf492253cd17d2dc61ee9.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/chutes/turn_cw/model.glb"
|
||||
dest_files=["res://.godot/imported/model.glb-1c5027ed37edf492253cd17d2dc61ee9.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
mesh_library/use_node_names_as_mesh_names=false
|
||||
array_mesh/deduplicate_surfaces=true
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
gltf/texture_map_mode=1
|
||||
@@ -0,0 +1,8 @@
|
||||
"""Rebuild only this resource using the shared collection authoring code."""
|
||||
from pathlib import Path
|
||||
import runpy
|
||||
|
||||
RESOURCE = Path(__file__).resolve().parent.parent.name
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
runpy.run_path(str(ROOT / 'assets/collections/storybook/source/build.py'),
|
||||
init_globals={'ONLY_ASSET': RESOURCE}, run_name='__main__')
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://b3e4pi6yhstur"
|
||||
path="res://.godot/imported/model.glb-eab00978b144585fd2168d1e604c12da.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/chutes/y_merge/baseline/model.glb"
|
||||
dest_files=["res://.godot/imported/model.glb-eab00978b144585fd2168d1e604c12da.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
mesh_library/use_node_names_as_mesh_names=false
|
||||
array_mesh/deduplicate_surfaces=true
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
gltf/texture_map_mode=1
|
||||
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://bjl5i582aemjl"
|
||||
path="res://.godot/imported/model.glb-1a5369006eace15b2d8f0d4219753534.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/chutes/y_merge/model.glb"
|
||||
dest_files=["res://.godot/imported/model.glb-1a5369006eace15b2d8f0d4219753534.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
mesh_library/use_node_names_as_mesh_names=false
|
||||
array_mesh/deduplicate_surfaces=true
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
gltf/texture_map_mode=1
|
||||
@@ -0,0 +1,8 @@
|
||||
"""Rebuild only this resource using the shared collection authoring code."""
|
||||
from pathlib import Path
|
||||
import runpy
|
||||
|
||||
RESOURCE = Path(__file__).resolve().parent.parent.name
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
runpy.run_path(str(ROOT / 'assets/collections/storybook/source/build.py'),
|
||||
init_globals={'ONLY_ASSET': RESOURCE}, run_name='__main__')
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"ballTypes": [
|
||||
{
|
||||
"ballTypeId": "iron_ball",
|
||||
"assetId": "iron_ball",
|
||||
"physicsProfileId": "solid_iron_test"
|
||||
}
|
||||
],
|
||||
"physicsProfiles": {
|
||||
"solid_iron_test": {
|
||||
"massKg": 890.0760306150601,
|
||||
"inertiaModel": "solidSphere",
|
||||
"dragCoefficient": 0.47,
|
||||
"contactMaterialId": "iron"
|
||||
}
|
||||
},
|
||||
"contactMaterialPairs": [
|
||||
{
|
||||
"materialAId": "iron",
|
||||
"materialBId": "painted_wood",
|
||||
"staticFriction": 0.42,
|
||||
"dynamicFriction": 0.32,
|
||||
"rollingResistance": 0.025,
|
||||
"restitution": 0.08
|
||||
},
|
||||
{
|
||||
"materialAId": "iron",
|
||||
"materialBId": "iron",
|
||||
"staticFriction": 0.35,
|
||||
"dynamicFriction": 0.25,
|
||||
"rollingResistance": 0.01,
|
||||
"restitution": 0.15
|
||||
}
|
||||
],
|
||||
"notes": [
|
||||
"Experimental contact coefficients; iron material is unchanged.",
|
||||
"Solid iron sphere radius 0.3 m at nominal density 7870 kg/m³: mass about 890.08 kg."
|
||||
],
|
||||
"airDensity": 1.225
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
"""Run inside Blender: parameterized wooden chutes + an iron sphere.
|
||||
Authoring axes: Z up. GLB export: (x, y, z) -> Godot (x, z, -y).
|
||||
Dimensions and colliders originate here, never in the gameplay physics table.
|
||||
"""
|
||||
import bpy
|
||||
import bmesh
|
||||
import json
|
||||
import math
|
||||
from pathlib import Path
|
||||
from mathutils import Vector
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
OUT = ROOT / 'assets/collections/baseline'
|
||||
SOURCE = Path(__file__).resolve().parent
|
||||
BALL_R = 0.3
|
||||
FIT_CLEARANCE = 0.02
|
||||
R = BALL_R + FIT_CLEARANCE
|
||||
HOLE_R = BALL_R + FIT_CLEARANCE
|
||||
GOAL_R = BALL_R + FIT_CLEARANCE
|
||||
GOAL_DEPTH = 0.55
|
||||
SIDES = 64
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
SOURCE.mkdir(parents=True, exist_ok=True)
|
||||
(ROOT/'playtest/artifacts/baseline').mkdir(parents=True, exist_ok=True)
|
||||
bpy.ops.object.select_all(action='SELECT')
|
||||
bpy.ops.object.delete(use_global=False)
|
||||
bpy.context.scene.unit_settings.system = 'METRIC'
|
||||
bpy.context.scene.unit_settings.scale_length = 1.0
|
||||
|
||||
|
||||
def material(name, color, roughness, metallic=0):
|
||||
m = bpy.data.materials.new(name)
|
||||
m.diffuse_color = (*color, 1)
|
||||
m.use_nodes = True
|
||||
node = m.node_tree.nodes.get('Principled BSDF')
|
||||
node.inputs['Base Color'].default_value = (*color, 1)
|
||||
node.inputs['Roughness'].default_value = roughness
|
||||
node.inputs['Metallic'].default_value = metallic
|
||||
return m
|
||||
|
||||
wood = material('Painted wood - warm ochre', (0.48, 0.29, 0.12), .48)
|
||||
channel = material('Painted wood - satin groove', (0.78, 0.59, 0.33), .40)
|
||||
iron = material('Iron - brushed', (.24, .29, .33), .24, .96)
|
||||
mark = material('Iron ball - orientation stripe', (.04, .075, .10), .46, .60)
|
||||
goal_material = material('Goal rim - green', (.063, .26, .17), .4, .25)
|
||||
|
||||
|
||||
def mesh_obj(name, verts, faces):
|
||||
mesh = bpy.data.meshes.new(name)
|
||||
mesh.from_pydata(verts, [], faces)
|
||||
mesh.validate()
|
||||
mesh.update()
|
||||
obj = bpy.data.objects.new(name, mesh)
|
||||
bpy.context.collection.objects.link(obj)
|
||||
bm = bmesh.new()
|
||||
bm.from_mesh(mesh)
|
||||
bmesh.ops.recalc_face_normals(bm, faces=bm.faces)
|
||||
bm.to_mesh(mesh)
|
||||
bm.free()
|
||||
return obj
|
||||
|
||||
|
||||
def top_height(x, rise):
|
||||
return 1 if rise == 0 else .5 + rise * (x + .5)
|
||||
|
||||
|
||||
def block(name, rise):
|
||||
half = 1.0 if name == 'y_merge' else .5
|
||||
verts = [(x, y, z) for z in [0, 1] for y in [-half, half] for x in [-half, half]]
|
||||
verts = [(x, y, top_height(x, rise) if z else 0) for x, y, z in verts]
|
||||
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)]
|
||||
obj = mesh_obj(name, verts, faces)
|
||||
obj.data.materials.append(wood)
|
||||
obj.data.materials.append(channel)
|
||||
return obj
|
||||
|
||||
|
||||
def tube(name, points, radius, mat):
|
||||
# Vertical semicircle section maintained along authoring path.
|
||||
vertices = []
|
||||
for i, point in enumerate(points):
|
||||
tangent = Vector(points[min(i+1,len(points)-1)]) - Vector(points[max(0,i-1)])
|
||||
side = Vector((-tangent.y, tangent.x, 0)).normalized()
|
||||
for j in range(SIDES):
|
||||
a = j * math.tau / SIDES
|
||||
v = Vector(point) + radius * math.cos(a) * side + Vector((0,0,radius*math.sin(a)))
|
||||
vertices.append(tuple(v))
|
||||
faces = []
|
||||
for i in range(len(points)-1):
|
||||
for j in range(SIDES):
|
||||
k=i*SIDES+j; n=i*SIDES+(j+1)%SIDES
|
||||
faces.append((k,n,n+SIDES,k+SIDES))
|
||||
faces += [tuple(reversed(range(SIDES))),tuple((len(points)-1)*SIDES+j for j in range(SIDES))]
|
||||
obj=mesh_obj(name,vertices,faces)
|
||||
obj.data.materials.append(wood)
|
||||
obj.data.materials.append(mat)
|
||||
for face in obj.data.polygons:
|
||||
face.material_index=1
|
||||
return obj
|
||||
|
||||
|
||||
def cut(body, cutter):
|
||||
bpy.context.view_layer.objects.active=body
|
||||
mod=body.modifiers.new('Actual channel void','BOOLEAN')
|
||||
mod.operation='DIFFERENCE'
|
||||
mod.solver='EXACT'
|
||||
mod.object=cutter
|
||||
bpy.ops.object.modifier_apply(modifier=mod.name)
|
||||
bpy.data.objects.remove(cutter,do_unlink=True)
|
||||
|
||||
|
||||
def extend(points, amount=.18):
|
||||
p=[Vector(v) for v in points]
|
||||
first=(p[1]-p[0]); first/=math.hypot(first.x,first.y)
|
||||
last=(p[-1]-p[-2]); last/=math.hypot(last.x,last.y)
|
||||
return [tuple(p[0]-first*amount)]+points+[tuple(p[-1]+last*amount)]
|
||||
|
||||
|
||||
def paths(kind,rise):
|
||||
if kind in ('straight','gentle','steep'):
|
||||
return [[(x,0,top_height(x,rise)) for x in [-.5+i/24 for i in range(25)]]]
|
||||
if kind in ('turn_cw','turn_ccw'):
|
||||
sign=-1 if kind=='turn_cw' else 1
|
||||
return [[(-.5+.5*math.sin(t),sign*(.5-.5*math.cos(t)),1) for t in [i*math.pi/2/48 for i in range(49)]]]
|
||||
# 2x2 Y connector: adjacent 1m lanes on the -X face, both at the same height.
|
||||
# Lane A continues straight; lane B merges through a tangent-continuous S.
|
||||
direct=[(-1+i/64*2,-.5,1) for i in range(65)]
|
||||
# Spread the lateral shift over the whole 2m length so the merging ball
|
||||
# retains forward momentum instead of striking the far wall sideways.
|
||||
branch=[]
|
||||
for i in range(129):
|
||||
t=i/128
|
||||
blend=3*t*t-2*t*t*t
|
||||
branch.append((-1+2*t,.5-blend,1))
|
||||
return [direct,branch]
|
||||
|
||||
|
||||
|
||||
def asset_dir(kind):
|
||||
category = 'balls' if kind == 'iron_ball' else 'goals' if kind == 'goal_hole' else 'blocks' if kind in ('wall','directional_boost') else 'chutes'
|
||||
return ROOT / 'assets' / category / kind
|
||||
|
||||
def export_objects(objects, name):
|
||||
export_path = asset_dir(name) / 'baseline/model.glb'
|
||||
export_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
bpy.ops.object.select_all(action='DESELECT')
|
||||
for obj in objects: obj.select_set(True)
|
||||
bpy.context.view_layer.objects.active=objects[0]
|
||||
bpy.ops.export_scene.gltf(filepath=str(export_path),export_format='GLB',use_selection=True,export_yup=True,export_extras=True,export_apply=True)
|
||||
|
||||
|
||||
def godot(v): return [round(v[0],6),round(v[2],6),round(-v[1],6)]
|
||||
|
||||
catalog={'schemaVersion':1,'unitsPerMeter':1,'authoringUp':'Z','runtimeUp':'Y','models':{}}
|
||||
report={'generator':'Blender Python','ball_radius_m':BALL_R,'groove_radius_m':R,'hole_radius_m':HOLE_R,'assets':[],
|
||||
'fit_clearance_m':FIT_CLEARANCE,'goal_radius_m':GOAL_R,
|
||||
'important':['Flat blocks now contain closed circular passages; ramp passages can open through the bottom and use the test platform as support.',
|
||||
'The steep ramp preserves 1m rise; its retained 1.5m prototype envelope remains explicitly flagged.']}
|
||||
showcase=[]
|
||||
for kind,rise in [('straight',0),('turn_cw',0),('turn_ccw',0),('gentle',.5),('steep',1),('y_merge',0)]:
|
||||
body=block(kind,rise)
|
||||
upper_paths=paths(kind,rise)
|
||||
for n,path in enumerate(upper_paths):
|
||||
cut(body,tube(f'{kind}_upper_{n}',extend(path),R,channel))
|
||||
floor_center=top_height(0,rise)-R
|
||||
hole_z=floor_center-HOLE_R*math.sqrt(1+rise*rise)-.02
|
||||
# Diagonal mirror swaps X/Y, while keeping lower passages level.
|
||||
lower_paths=[[(y,x,hole_z) for x,y,z in path] for path in upper_paths]
|
||||
for n,path in enumerate(lower_paths):
|
||||
cut(body,tube(f'{kind}_lower_{n}',extend(path),HOLE_R,wood))
|
||||
for face in body.data.polygons:
|
||||
face.use_smooth=(face.material_index==1)
|
||||
body['asset_id']=kind
|
||||
body['groove_radius_m']=R
|
||||
declared_size=[2.0,2.0,1.0] if kind=='y_merge' else [1.0,1.0,1.0]
|
||||
body['declared_size_m']=declared_size
|
||||
body['rise_m']=rise
|
||||
bpy.context.view_layer.update()
|
||||
coords=[body.matrix_world @ v.co for v in body.data.vertices]
|
||||
low=[min(v[i] for v in coords) for i in range(3)]
|
||||
high=[max(v[i] for v in coords) for i in range(3)]
|
||||
bounds=[round(high[i]-low[i],6) for i in range(3)]
|
||||
# Sample the actual final boolean mesh for open channels and clearance.
|
||||
from mathutils.bvhtree import BVHTree
|
||||
tree=BVHTree.FromObject(body,bpy.context.evaluated_depsgraph_get())
|
||||
minimum_clearance=10.0
|
||||
for path in lower_paths:
|
||||
for point in path[::4]:
|
||||
loc,normal,index,distance=tree.find_nearest(Vector(point))
|
||||
if loc is not None: minimum_clearance=min(minimum_clearance,distance)
|
||||
manifold=bmesh.new();manifold.from_mesh(body.data)
|
||||
bad_edges=sum(not e.is_manifold for e in manifold.edges);manifold.free()
|
||||
upper_ports=[]
|
||||
for path in upper_paths:
|
||||
for idx in [0,-1]:
|
||||
v=Vector(path[idx]);v.z-=R
|
||||
tangent=Vector(path[1])-Vector(path[0]) if idx==0 else Vector(path[-1])-Vector(path[-2])
|
||||
tangent.normalize()
|
||||
if kind=='y_merge':
|
||||
tangent=Vector((1,0,0)) # parallel interfaces on the opposite X faces
|
||||
entry={'surface':godot(v),'travel':godot(tangent)}
|
||||
if not any(p['surface']==entry['surface'] for p in upper_ports):upper_ports.append(entry)
|
||||
meta={'path':'res://'+str((asset_dir(kind)/'baseline/model.glb').relative_to(ROOT)),'radius':None,'rise':rise,'grooveRadius':R,'passageRadius':HOLE_R,
|
||||
'upperPaths':[[godot(p) for p in path] for path in upper_paths],
|
||||
'lowerPaths':[[godot(p) for p in path] for path in lower_paths],
|
||||
'ports':upper_ports,'bottomArchCenter':hole_z,'bottomRouteFloor':hole_z-HOLE_R,
|
||||
'boundsBlender':{'min':low,'max':high,'size':bounds},'nominalCellFits':all(d<=1.001 for d in bounds),
|
||||
'cellFootprint':[int(declared_size[0]),int(declared_size[1])],
|
||||
'declaredSize':declared_size,'declaredBoundsFits':all(bounds[i]<=declared_size[i]+.001 for i in range(3)),
|
||||
'prototypeNotes':[] if rise!=1 else ['Full semicircle plus 1m rise exceeds the nominal 1m cell height.']}
|
||||
body['single_cell_compliant']=meta['nominalCellFits']
|
||||
body['declared_size_compliant']=meta['declaredBoundsFits']
|
||||
export_objects([body],kind)
|
||||
catalog['models'][kind]=meta
|
||||
report['assets'].append({'id':kind,'size_m':bounds,'single_cell_compliant':meta['nominalCellFits'],
|
||||
'declared_size_m':declared_size,'declared_size_compliant':meta['declaredBoundsFits'],
|
||||
'mesh_vertices':len(body.data.vertices),'mesh_faces':len(body.data.polygons),'non_manifold_edges':bad_edges,
|
||||
'lower_path_min_distance_to_mesh_m':round(minimum_clearance,6),'lower_route_floor_local_z':hole_z-HOLE_R,
|
||||
'passage_open_at_bottom':hole_z-HOLE_R<0})
|
||||
showcase.append(body)
|
||||
|
||||
if kind=='y_merge':
|
||||
report['y_connections']={'inlet_surface_positions':[godot((-1,-.5,1-R)),godot((-1,.5,1-R))],
|
||||
'outlet_surface_position':godot((1,-.5,1-R)),'inlet_center_spacing_m':1.0,'inlet_height_difference_m':0.0,
|
||||
'lower_passage':'closed circular bore in the same block'}
|
||||
|
||||
bpy.ops.mesh.primitive_uv_sphere_add(segments=64,ring_count=32,radius=BALL_R,location=(0,0,0))
|
||||
ball=bpy.context.object;ball.name='iron_ball';ball.data.materials.append(iron);ball.data.materials.append(mark)
|
||||
for face in ball.data.polygons:
|
||||
face.use_smooth=True
|
||||
# A narrow painted orientation band makes true rotation visible.
|
||||
center=sum((ball.data.vertices[i].co for i in face.vertices),Vector())/len(face.vertices)
|
||||
if abs(center.y)<.025:face.material_index=1
|
||||
ball['asset_id']='iron_ball';ball['radius_m']=BALL_R
|
||||
export_objects([ball],'iron_ball')
|
||||
catalog['models']['iron_ball']={'path':'res://assets/balls/iron_ball/baseline/model.glb','radius':BALL_R,'boundsBlender':{'size':[2*BALL_R]*3}}
|
||||
report['measured_ball_radius_m']=max(v.co.length for v in ball.data.vertices)
|
||||
|
||||
# A true narrow goal aperture: both entrance and throat have the same radius.
|
||||
goal_vertices=[]
|
||||
for z,rad in [(0,GOAL_R),(0,GOAL_R+.04),(-GOAL_DEPTH,GOAL_R),(-GOAL_DEPTH,GOAL_R+.04)]:
|
||||
for i in range(96):
|
||||
a=i*math.tau/96
|
||||
goal_vertices.append((rad*math.cos(a),rad*math.sin(a),z))
|
||||
goal_faces=[]
|
||||
for i in range(96):
|
||||
j=(i+1)%96
|
||||
goal_faces += [(i,j,96+j,96+i),(192+i,288+i,288+j,192+j),(i,192+i,192+j,j),(96+i,96+j,288+j,288+i)]
|
||||
goal=mesh_obj('goal_hole',goal_vertices,goal_faces)
|
||||
goal.data.materials.append(goal_material)
|
||||
goal['asset_id']='goal_hole';goal['opening_radius_m']=GOAL_R
|
||||
export_objects([goal],'goal_hole')
|
||||
catalog['models']['goal_hole']={'path':'res://assets/goals/goal_hole/baseline/model.glb','role':'goal','openingRadius':GOAL_R,'depth':GOAL_DEPTH,'rimThickness':.04}
|
||||
(OUT/'catalog.json').write_text(json.dumps(catalog,indent=2,ensure_ascii=False))
|
||||
(ROOT/'playtest/artifacts/baseline/geometry_report.json').write_text(json.dumps(report,indent=2,ensure_ascii=False))
|
||||
for i,obj in enumerate(showcase):obj.location=(i%3*1.6,i//3*1.8,0)
|
||||
ball.location=(5.5,.5,BALL_R)
|
||||
goal.location=(6.5,.5,GOAL_DEPTH)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(SOURCE/'collection.blend'))
|
||||
print('INTOHOLE_ASSETS_READY',OUT)
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"interactive": [
|
||||
{
|
||||
"id": "directional_boost",
|
||||
"name": "定向加速",
|
||||
"assetId": "directional_boost"
|
||||
}
|
||||
],
|
||||
"nonInteractive": [
|
||||
{
|
||||
"id": "wall",
|
||||
"name": "标准墙壁",
|
||||
"assetId": "wall"
|
||||
},
|
||||
{
|
||||
"id": "goal_hole",
|
||||
"name": "锥口球洞",
|
||||
"assetId": "goal_hole"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"ballTypes": [
|
||||
{
|
||||
"ballTypeId": "iron_ball",
|
||||
"assetId": "iron_ball",
|
||||
"physicsProfileId": "solid_iron_test"
|
||||
}
|
||||
],
|
||||
"physicsProfiles": {
|
||||
"solid_iron_test": {
|
||||
"massKg": 890.0760306150601,
|
||||
"inertiaModel": "solidSphere",
|
||||
"dragCoefficient": 0.47,
|
||||
"contactMaterialId": "iron"
|
||||
}
|
||||
},
|
||||
"contactMaterialPairs": [
|
||||
{
|
||||
"materialAId": "iron",
|
||||
"materialBId": "painted_wood",
|
||||
"staticFriction": 0.42,
|
||||
"dynamicFriction": 0.32,
|
||||
"rollingResistance": 0.025,
|
||||
"restitution": 0.08
|
||||
},
|
||||
{
|
||||
"materialAId": "iron",
|
||||
"materialBId": "iron",
|
||||
"staticFriction": 0.35,
|
||||
"dynamicFriction": 0.25,
|
||||
"rollingResistance": 0.01,
|
||||
"restitution": 0.15
|
||||
}
|
||||
],
|
||||
"notes": [
|
||||
"Experimental contact coefficients; iron material is unchanged.",
|
||||
"Solid iron sphere radius 0.3 m at nominal density 7870 kg/m³: mass about 890.08 kg."
|
||||
],
|
||||
"airDensity": 1.225
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
"""Blender-only authoring of a separate Railbound-inspired asset family.
|
||||
|
||||
Copies a stable source once; never writes to the baseline assets. To adopt a
|
||||
later baseline, remove only this family's source_snapshot files explicitly.
|
||||
"""
|
||||
import bpy
|
||||
import bmesh
|
||||
import hashlib
|
||||
import json
|
||||
import math
|
||||
import shutil
|
||||
import time
|
||||
from pathlib import Path
|
||||
from mathutils import Vector
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
SOURCE = Path(__file__).resolve().parent
|
||||
SNAPSHOT = SOURCE / 'snapshot'
|
||||
SNAPSHOT.mkdir(parents=True, exist_ok=True)
|
||||
ONLY_ASSET = globals().get('ONLY_ASSET')
|
||||
REPORTS = ROOT / 'playtest/artifacts/styled'
|
||||
REPORTS.mkdir(parents=True, exist_ok=True)
|
||||
OUT = SOURCE.parent
|
||||
SOURCE.mkdir(parents=True, exist_ok=True)
|
||||
snapshot = SNAPSHOT / 'source_snapshot.blend'
|
||||
inputs = [ROOT/'assets/collections/baseline/source/collection.blend',
|
||||
ROOT/'assets/collections/baseline/catalog.json', ROOT/'assets/collections/baseline/physics.json']
|
||||
def digest(path):
|
||||
return hashlib.sha256(path.read_bytes()).hexdigest()
|
||||
|
||||
if not snapshot.exists():
|
||||
before = [digest(p) for p in inputs]
|
||||
time.sleep(3)
|
||||
if before != [digest(p) for p in inputs]:
|
||||
raise RuntimeError('Baseline is changing. Wait for its current build, then retry.')
|
||||
copies = [snapshot, SNAPSHOT/'source_catalog.json', SNAPSHOT/'source_physics.json']
|
||||
for src, dst in zip(inputs, copies):
|
||||
shutil.copy2(src, dst)
|
||||
if before != [digest(p) for p in inputs] or before != [digest(p) for p in copies]:
|
||||
for p in copies: p.unlink(missing_ok=True)
|
||||
raise RuntimeError('Baseline changed during copy. No snapshot was retained.')
|
||||
(SNAPSHOT/'source_manifest.json').write_text(json.dumps({
|
||||
'files': {str(p.relative_to(ROOT)): h for p,h in zip(inputs,before)},
|
||||
'copiedAtUnix': time.time(), 'readOnlyBaseline': True}, indent=2))
|
||||
|
||||
bpy.ops.wm.open_mainfile(filepath=str(snapshot))
|
||||
bpy.context.preferences.filepaths.save_version=0
|
||||
catalog = json.loads((SNAPSHOT/'source_catalog.json').read_text())
|
||||
physics = json.loads((SNAPSHOT/'source_physics.json').read_text())
|
||||
palette = {'body':'B98A56', 'top':'E9C88B', 'groove':'FFF0C5',
|
||||
'ink':'342E38', 'iron':'788A9E', 'iron_light':'C6DFE5',
|
||||
'red':'CB6652', 'green':'799361'}
|
||||
def mat(name, color, metallic=0.0, roughness=.85):
|
||||
m = bpy.data.materials.new('Storybook / '+name)
|
||||
rgba = tuple(int(color[i:i+2],16)/255 for i in (0,2,4))+(1,)
|
||||
# Hex palette is sRGB; Blender's material values are linear.
|
||||
rgba = tuple(((v+.055)/1.055)**2.4 if v>.04045 else v/12.92 for v in rgba[:3])+(1,)
|
||||
m.diffuse_color = rgba
|
||||
m.use_nodes = True
|
||||
bsdf = m.node_tree.nodes.get('Principled BSDF')
|
||||
bsdf.inputs['Base Color'].default_value = rgba
|
||||
bsdf.inputs['Metallic'].default_value = metallic
|
||||
bsdf.inputs['Roughness'].default_value = roughness
|
||||
return m
|
||||
mats={k:mat(k,v) for k,v in palette.items()}
|
||||
mats['iron']=mat('iron satin','788A9E',.35,.5)
|
||||
mats['wall']=mat('wall stone','A29E8B')
|
||||
mats['wall_top']=mat('wall stone top','D8D3B4')
|
||||
|
||||
def mesh_object(name,vertices,faces):
|
||||
mesh=bpy.data.meshes.new(name)
|
||||
mesh.from_pydata(vertices,[],faces);mesh.update()
|
||||
bm=bmesh.new();bm.from_mesh(mesh)
|
||||
bmesh.ops.recalc_face_normals(bm,faces=bm.faces);bm.to_mesh(mesh);bm.free()
|
||||
obj=bpy.data.objects.new(name,mesh);bpy.context.collection.objects.link(obj)
|
||||
return obj
|
||||
|
||||
def build_funnel():
|
||||
bpy.data.objects.remove(bpy.data.objects['goal_hole'],do_unlink=True)
|
||||
# A closed shell with a wide conical entrance and a true narrow outlet.
|
||||
profile=[(.46,0),(.32,-.35),(.32,-1),(.36,-1),(.50,0)]
|
||||
sides=96
|
||||
vertices=[(radius*math.cos(i*math.tau/sides),radius*math.sin(i*math.tau/sides),z)
|
||||
for radius,z in profile for i in range(sides)]
|
||||
faces=[]
|
||||
for ring in range(len(profile)):
|
||||
next_ring=(ring+1)%len(profile)
|
||||
for i in range(sides):
|
||||
j=(i+1)%sides
|
||||
faces.append((ring*sides+i,ring*sides+j,next_ring*sides+j,next_ring*sides+i))
|
||||
return mesh_object('goal_hole',vertices,faces)
|
||||
|
||||
def build_wall(name='wall'):
|
||||
vertices=[(x,y,z) for z in (0,1) for y in (-.5,.5) for x in (-.5,.5)]
|
||||
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')
|
||||
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]}
|
||||
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]},
|
||||
'declaredSize':[1,1,1],'geometryOrigin':'authored'}
|
||||
|
||||
def export(objects, path):
|
||||
bpy.ops.object.select_all(action='DESELECT')
|
||||
for obj in objects: obj.select_set(True)
|
||||
bpy.context.view_layer.objects.active=objects[0]
|
||||
path.parent.mkdir(parents=True,exist_ok=True)
|
||||
bpy.ops.export_scene.gltf(filepath=str(path),export_format='GLB',
|
||||
use_selection=True,export_yup=True,export_extras=True,export_apply=True)
|
||||
|
||||
def lines(name, segments, radius=.012):
|
||||
curve=bpy.data.curves.new('ink_'+name,'CURVE')
|
||||
curve.dimensions='3D'; curve.bevel_depth=radius; curve.bevel_resolution=0
|
||||
curve.resolution_u=1
|
||||
for points in segments:
|
||||
spline=curve.splines.new('POLY'); spline.points.add(len(points)-1)
|
||||
for point, value in zip(spline.points,points):point.co=(*value,1)
|
||||
obj=bpy.data.objects.new('ink_'+name,curve)
|
||||
bpy.context.collection.objects.link(obj); obj.data.materials.append(mats['ink'])
|
||||
obj['visual_only']=True
|
||||
return obj
|
||||
|
||||
def outline(obj):
|
||||
bm=bmesh.new();bm.from_mesh(obj.data);bm.normal_update()
|
||||
segments=[]
|
||||
for edge in bm.edges:
|
||||
if len(edge.link_faces)!=2 or edge.calc_face_angle(0)>math.radians(36):
|
||||
segments.append([tuple(v.co) for v in edge.verts])
|
||||
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') else 'chutes'
|
||||
return ROOT / 'assets' / category / kind
|
||||
|
||||
kinds=['straight','turn_cw','turn_ccw','gentle','steep','y_merge']
|
||||
groups=[];report=[]
|
||||
all_kinds=kinds+['iron_ball','goal_hole','wall','directional_boost']
|
||||
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):
|
||||
obj=bpy.data.objects[kind]
|
||||
obj.location=(0,0,0)
|
||||
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 in kinds:
|
||||
for key in ['body','groove','top']:obj.data.materials.append(mats[key])
|
||||
for face,old in zip(obj.data.polygons,old_indices):
|
||||
face.material_index=1 if old==1 else (2 if face.normal.z>.55 else 0)
|
||||
group=[obj,outline(obj)]
|
||||
category='chutes'
|
||||
elif kind=='iron_ball':
|
||||
for key in ['iron','ink','iron_light']:obj.data.materials.append(mats[key])
|
||||
for face,old in zip(obj.data.polygons,old_indices):
|
||||
face.material_index=1 if old==1 else 0
|
||||
# An authored, low-detail bright cap gives the sphere a graphic highlight.
|
||||
if face.center.z>0.19 and face.center.x<-.04 and old!=1:face.material_index=2
|
||||
group=[obj]
|
||||
category='balls'
|
||||
elif kind=='goal_hole':
|
||||
obj.data.materials.append(mats['red'])
|
||||
obj.data.materials.append(mats['top'])
|
||||
obj.data.materials.append(mats['ink'])
|
||||
for face in obj.data.polygons:
|
||||
face.material_index=1 if face.index<96 else (2 if face.index<192 else 0)
|
||||
face.use_smooth=face.index<192
|
||||
group=[obj,outline(obj)]
|
||||
category='environment'
|
||||
else:
|
||||
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') else 'unchanged source mesh'
|
||||
export(group,asset_dir(kind)/'model.glb')
|
||||
catalog['models'][kind]['path']='res://'+str((asset_dir(kind)/'model.glb').relative_to(ROOT))
|
||||
catalog['models'][kind]['sourceBlend']=str((asset_dir(kind)/'source/model.blend').relative_to(ROOT))
|
||||
for member in group:
|
||||
if member.type=='CURVE':
|
||||
bpy.ops.object.select_all(action='DESELECT');member.select_set(True)
|
||||
bpy.context.view_layer.objects.active=member
|
||||
bpy.ops.object.convert(target='MESH')
|
||||
source_path=asset_dir(kind)/'source/model.blend'
|
||||
source_path.parent.mkdir(parents=True,exist_ok=True)
|
||||
# A separate editable source file contains only one asset family member.
|
||||
report.append({'id':kind,'collisionGeometryUnchanged':kind not in ('wall','goal_hole','directional_boost') and before_coords==[tuple(v.co) for v in obj.data.vertices],
|
||||
'vertices':len(obj.data.vertices),'separateBlend':str(source_path.relative_to(ROOT))})
|
||||
groups.append(group)
|
||||
|
||||
if ONLY_ASSET:
|
||||
existing=json.loads((OUT/'catalog.json').read_text())
|
||||
existing['models'][ONLY_ASSET]=catalog['models'][ONLY_ASSET]
|
||||
catalog=existing
|
||||
else:
|
||||
catalog['models']={k:catalog['models'][k] for k in all_kinds}
|
||||
catalog['styleFamily']='railbound_inspired'
|
||||
catalog['palette']=palette
|
||||
(OUT/'catalog.json').write_text(json.dumps(catalog,ensure_ascii=False,indent=2))
|
||||
if not ONLY_ASSET:
|
||||
(OUT/'physics.json').write_text(json.dumps(physics,ensure_ascii=False,indent=2))
|
||||
(OUT/'entities.json').write_text(json.dumps({'interactive':[{'id':'directional_boost','name':'定向加速','assetId':'directional_boost'}],
|
||||
'nonInteractive':[{'id':'wall','name':'标准墙壁','assetId':'wall'},
|
||||
{'id':'goal_hole','name':'锥口球洞','assetId':'goal_hole'}]},ensure_ascii=False,indent=2))
|
||||
if ONLY_ASSET:
|
||||
names={member.name for member in groups[0]}
|
||||
for obj in list(bpy.data.objects):
|
||||
if obj.name not in names:bpy.data.objects.remove(obj,do_unlink=True)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(ROOT/report[0]['separateBlend']))
|
||||
else:
|
||||
for i,group in enumerate(groups):
|
||||
for member in group:member.location=(i%4*2.6,i//4*3,0)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(SOURCE/'collection.blend'))
|
||||
group_names=[[member.name for member in group] for group in groups]
|
||||
for entry, names in zip(report,group_names):
|
||||
bpy.ops.wm.open_mainfile(filepath=str(SOURCE/'collection.blend'))
|
||||
for obj in list(bpy.data.objects):
|
||||
if obj.name not in names:bpy.data.objects.remove(obj,do_unlink=True)
|
||||
else:obj.location=(0,0,0)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(ROOT/entry['separateBlend']))
|
||||
(REPORTS/(('asset_'+ONLY_ASSET+'.json') if ONLY_ASSET else 'assets.json')).write_text(json.dumps({
|
||||
'sourceManifest':json.loads((SNAPSHOT/'source_manifest.json').read_text()),
|
||||
'models':report,'radius':catalog['models']['iron_ball']['radius'],
|
||||
'physicalMaterialUnchanged':True,'outlineGeometry':'visual only'},indent=2))
|
||||
print('STYLE_ASSETS_READY')
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"files": {
|
||||
"assets/collections/baseline/source/collection.blend": "f81477cb30f5f5eb5a486a3a5e75c95b097204cfa5380c286cb1b40a85ee6962",
|
||||
"assets/collections/baseline/catalog.json": "7af16a52c10655df0353198e0de97864aaa1b7669503139e7c4f727450929085",
|
||||
"assets/collections/baseline/physics.json": "b12802f7763c162d037b0795e79272955031162790424831e88c939288f5526e"
|
||||
},
|
||||
"copiedAtUnix": 1794720924.17409,
|
||||
"readOnlyBaseline": true,
|
||||
"layoutMigration": "2026-11-16: paths moved; catalog resource paths rewritten; previous hashes retained in source_manifest.pre_reorganization.json"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"files": {
|
||||
"assets/blender/intohole_playtest.blend": "f81477cb30f5f5eb5a486a3a5e75c95b097204cfa5380c286cb1b40a85ee6962",
|
||||
"playtest/assets/generated/catalog.json": "e2b22e92f53b2d26f6ee90a72f4148084c3d6402f51ce6d6c5b8bc552e21af86",
|
||||
"playtest/data/physics.json": "b12802f7763c162d037b0795e79272955031162790424831e88c939288f5526e"
|
||||
},
|
||||
"copiedAtUnix": 1794720924.17409,
|
||||
"readOnlyBaseline": true
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"ballTypes": [
|
||||
{
|
||||
"ballTypeId": "iron_ball",
|
||||
"assetId": "iron_ball",
|
||||
"physicsProfileId": "solid_iron_test"
|
||||
}
|
||||
],
|
||||
"physicsProfiles": {
|
||||
"solid_iron_test": {
|
||||
"massKg": 890.0760306150601,
|
||||
"inertiaModel": "solidSphere",
|
||||
"dragCoefficient": 0.47,
|
||||
"contactMaterialId": "iron"
|
||||
}
|
||||
},
|
||||
"contactMaterialPairs": [
|
||||
{
|
||||
"materialAId": "iron",
|
||||
"materialBId": "painted_wood",
|
||||
"staticFriction": 0.42,
|
||||
"dynamicFriction": 0.32,
|
||||
"rollingResistance": 0.025,
|
||||
"restitution": 0.08
|
||||
},
|
||||
{
|
||||
"materialAId": "iron",
|
||||
"materialBId": "iron",
|
||||
"staticFriction": 0.35,
|
||||
"dynamicFriction": 0.25,
|
||||
"rollingResistance": 0.01,
|
||||
"restitution": 0.15
|
||||
}
|
||||
],
|
||||
"notes": [
|
||||
"Experimental contact coefficients; iron material is unchanged.",
|
||||
"Solid iron sphere radius 0.3 m at nominal density 7870 kg/m³: mass about 890.08 kg."
|
||||
],
|
||||
"airDensity": 1.225
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,68 @@
|
||||
"""Reopen every delivered .blend and compare physical meshes with the snapshot."""
|
||||
import bpy
|
||||
import bmesh
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
ROOT=Path(__file__).resolve().parents[4]
|
||||
SOURCE=Path(__file__).resolve().parent/'snapshot'
|
||||
catalog=json.loads((ROOT/'assets/collections/storybook/catalog.json').read_text())
|
||||
bpy.ops.wm.open_mainfile(filepath=str(SOURCE/'source_snapshot.blend'))
|
||||
|
||||
def geometry(obj):
|
||||
return ([list(v.co) for v in obj.data.vertices],
|
||||
[list(p.vertices) for p in obj.data.polygons])
|
||||
|
||||
baseline={kind:geometry(bpy.data.objects[kind]) for kind in catalog['models'] if kind in bpy.data.objects}
|
||||
checks=[]
|
||||
for kind,data in catalog['models'].items():
|
||||
path=ROOT/data['sourceBlend']
|
||||
bpy.ops.wm.open_mainfile(filepath=str(path))
|
||||
obj=bpy.data.objects[kind]
|
||||
physical=[o for o in bpy.context.scene.objects if not o.name.startswith('ink_')]
|
||||
authored=data.get('geometryOrigin')=='authored'
|
||||
mesh_match=None if authored else geometry(obj)==baseline[kind]
|
||||
correct=(len(physical)==1 and physical[0].name==kind and
|
||||
(authored or mesh_match) and obj.location.length<1e-6 and
|
||||
all(abs(x-1)<1e-6 for x in obj.scale))
|
||||
check={'id':kind,'passed':correct,'objects':[o.name for o in bpy.context.scene.objects],
|
||||
'geometryMatchesSnapshot':mesh_match,
|
||||
'origin':list(obj.location),'dimensions':list(obj.dimensions),
|
||||
'materials':[m.name for m in obj.data.materials]}
|
||||
if kind=='iron_ball':
|
||||
radius=max(v.co.length for v in obj.data.vertices)
|
||||
check['measuredRadius']=radius
|
||||
correct=correct and abs(radius-data['radius'])<1e-6
|
||||
check['passed']=correct
|
||||
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 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)
|
||||
else:
|
||||
rings={}
|
||||
for vertex in obj.data.vertices:
|
||||
z=round(vertex.co.z,5);radius=round((vertex.co.x**2+vertex.co.y**2)**.5,5)
|
||||
rings.setdefault(str(z),set()).add(radius)
|
||||
correct=correct and rings=={'0.0':{.46,.5},'-0.35':{.32},'-1.0':{.32,.36}}
|
||||
check['measuredRings']={k:sorted(v) for k,v in rings.items()}
|
||||
check.update({'passed':correct,'closedManifold':closed,'solidVolume':volume})
|
||||
checks.append(check)
|
||||
manifest=json.loads((SOURCE/'source_manifest.json').read_text())
|
||||
source_status={p:hashlib.sha256((ROOT/p).read_bytes()).hexdigest()==sha
|
||||
for p,sha in manifest['files'].items()}
|
||||
result={'passed':sum(c['passed'] for c in checks),'failed':sum(not c['passed'] for c in checks),
|
||||
'baselineStillMatchesSnapshot':source_status,'checks':checks}
|
||||
(ROOT/'playtest/artifacts/styled/reopened_assets.json').write_text(json.dumps(result,indent=2))
|
||||
if result['failed']:raise RuntimeError('Standalone source asset verification failed')
|
||||
print('REOPENED_ASSETS_VERIFIED',result['passed'])
|
||||
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://ddese740rynta"
|
||||
path="res://.godot/imported/model.glb-3c704f2ca09a958e53029997aab04263.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/goals/goal_hole/baseline/model.glb"
|
||||
dest_files=["res://.godot/imported/model.glb-3c704f2ca09a958e53029997aab04263.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
mesh_library/use_node_names_as_mesh_names=false
|
||||
array_mesh/deduplicate_surfaces=true
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
gltf/texture_map_mode=1
|
||||
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://b47w5my036nwg"
|
||||
path="res://.godot/imported/model.glb-d285c1a541c65e53b4e6765b5169a459.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/goals/goal_hole/model.glb"
|
||||
dest_files=["res://.godot/imported/model.glb-d285c1a541c65e53b4e6765b5169a459.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
mesh_library/use_node_names_as_mesh_names=false
|
||||
array_mesh/deduplicate_surfaces=true
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
gltf/texture_map_mode=1
|
||||
@@ -0,0 +1,8 @@
|
||||
"""Rebuild only this resource using the shared collection authoring code."""
|
||||
from pathlib import Path
|
||||
import runpy
|
||||
|
||||
RESOURCE = Path(__file__).resolve().parent.parent.name
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
runpy.run_path(str(ROOT / 'assets/collections/storybook/source/build.py'),
|
||||
init_globals={'ONLY_ASSET': RESOURCE}, run_name='__main__')
|
||||
Binary file not shown.
Reference in New Issue
Block a user