[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7FBKT29CJ8G8FCJR70PXZ6N":3,"skill-same:01M7FBKT29CJ8G8FCJR70PXZ6N":72},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M7FBKT29CJ8G8FCJR70PXZ6N","godot-3d",null,"搭建或调试 Godot 4 的 3D 场景时用。CharacterBody3D 角色移动、第一 第三人称相机 SpringArm3D、Jolt 物理与碰撞层、RayCast3D 查询、渲染器与光照 GI 选型 SDFGI VoxelGI LightmapGI、阴影、glTF 导入、GridMap、CSG、LOD 与遮挡剔除、MultiMesh、NavigationAgent3D、骨骼修改器 IK。3D scenes, character controllers, lighting, level import.","MindsMaster\u002Fgodot-claude-code-skills","MindsMaster","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F167383411?v=4","01M7FBJFZBSAXET9TF9WDFRCJW","An5w1r","01M7FBJFZZRARX0F1VSWHTH9EM",3,"MIT","https:\u002F\u002Fgithub.com\u002FMindsMaster\u002Fgodot-claude-code-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fgodot-3d\u002FSKILL.md",[],[],"2026-11-16 10:05:34",false,"---\nname: godot-3d\ndescription: 搭建或调试 Godot 4 的 3D 场景时用。CharacterBody3D 角色移动、第一 第三人称相机 SpringArm3D、Jolt 物理与碰撞层、RayCast3D 查询、渲染器与光照 GI 选型 SDFGI VoxelGI LightmapGI、阴影、glTF 导入、GridMap、CSG、LOD 与遮挡剔除、MultiMesh、NavigationAgent3D、骨骼修改器 IK。3D scenes, character controllers, lighting, level import.\n---\n\n# Godot 3D\n\n3D 场景用哪个节点、哪个资源、哪个项目设置，以及照直觉会写错的地方。\n\n## 范围\n\n| 不含 | 去哪 |\n|---|---|\n| 着色器、粒子、后处理 | godot-shaders-vfx |\n| 动画状态机、AnimationTree | godot-animation |\n| 2D 精灵放进 3D | godot-2d-in-3d |\n| 帧率剖析、大量实体 | godot-performance |\n\n## 先查内置\n\n| 需求 | 用这个 | 别自己写 |\n|---|---|---|\n| 角色走跑跳 | `CharacterBody3D` + `move_and_slide()` | 手算坡度和地面检测 |\n| 推得动的箱子、球 | `RigidBody3D`，一次性冲击 `apply_central_impulse`，持续推力 `apply_central_force` | 每帧改 `global_position` 或 `linear_velocity` |\n| 第三人称相机不穿墙 | `SpringArm3D` | 每帧射线加手动拉近 |\n| 点选 狙击 视线 | `PhysicsRayQueryParameters3D` + `intersect_ray()` | 遍历所有物体算相交 |\n| 前方探测 持续检测 | `RayCast3D` `ShapeCast3D` | 每帧 new 查询参数 |\n| 敌人寻路与避让 | `NavigationRegion3D` + `NavigationAgent3D` | 手写 A* 和路点 |\n| 大量相同网格 草 石头 | `MultiMeshInstance3D` | 几千个 `MeshInstance3D` |\n| 远处降面 | 导入时自动 mesh LOD | 脚本按距离换网格 |\n| 远处整组替换 淡出标签 | `GeometryInstance3D.visibility_range_end` | 脚本逐帧算距离 |\n| 室内遮挡 | `OccluderInstance3D` | 手动隐藏房间 |\n| 弹孔 污渍 假阴影 | `Decal` | 运行时拼贴图网格 |\n| 灰盒关卡 | CSG 节点 后转 `MeshInstance3D` | 把 CSG 带进发布版 |\n| 网格拼装关卡 | `GridMap` + `MeshLibrary` | 脚本循环摆几百个实例 |\n| 头部看向 尾巴发丝摆动 腿部 IK | 骨骼修改器 见下文版本表 | 每帧手改 `Skeleton3D` 骨骼姿态 |\n| 天空 雾 泛光 色调映射 | `WorldEnvironment` + `Environment` | 多个 `SubViewport` 堆后处理 |\n| 曝光 景深 | `CameraAttributesPractical` | 脚本改亮度 |\n| 间接光 | SDFGI VoxelGI LightmapGI | 到处摆补光灯 |\n| 导入后加碰撞 | 名字后缀 `-col` 或高级导入设置 | 导入后脚本遍历加 `CollisionShape3D` |\n| 高刷新率下相机抖动 | `physics\u002Fcommon\u002Fphysics_interpolation` | 自己在 `_process` 里插值 |\n\n## 做法\n\n### 角色移动\n\n```gdscript\nextends CharacterBody3D\n\n@export var speed: float = 5.0\n@export var jump_velocity: float = 4.5\n\nfunc _physics_process(delta: float) -> void:\n\tif not is_on_floor():\n\t\tvelocity += get_gravity() * delta\n\telif Input.is_action_just_pressed(\"jump\"):\n\t\tvelocity.y = jump_velocity\n\n\tvar input: Vector2 = Input.get_vector(\"move_left\", \"move_right\", \"move_forward\", \"move_back\")\n\tvar direction: Vector3 = global_basis * Vector3(input.x, 0.0, input.y)\n\tvelocity.x = direction.x * speed\n\tvelocity.z = direction.z * speed\n\tmove_and_slide()\n```\n\n- `velocity` 是每秒速度，不乘 `delta`\n- `get_vector` 长度已限制为 1，不再 `normalized()`，摇杆轻推保持慢速\n- `is_on_floor()` 读的是上一次 `move_and_slide()` 的结果\n- 相机相对移动时用相机的 yaw 基底代替 `global_basis`\n- 没有内置台阶，用斜面碰撞体，或 `ShapeCast3D` 自己检测\n- 重力方向不是 Y 时改 `up_direction`\n\n- 坡度、贴地、撞墙等属性默认值见 [references\u002Fphysics-3d.md](references\u002Fphysics-3d.md)\n\n### 物理引擎\n\n| 引擎 | 状态 |\n|---|---|\n| Jolt Physics | 4.4+ 内置，4.6 起新建项目默认，通常更快更稳 |\n| GodotPhysics3D | 设置值 `DEFAULT` 在 4.7 仍等于它，老项目升级后保持 |\n\n```ini\n[physics]\n\n3d\u002Fphysics_engine=\"Jolt Physics\"\n```\n\n- 4.5 及更早升级的项目手动改，改完重启编辑器\n- Jolt 与 GodotPhysics3D 的差异见 [references\u002Fphysics-3d.md](references\u002Fphysics-3d.md)\n\n### 碰撞层\n\n先列碰撞对再分层，在 `layer_names\u002F3d_physics\u002Flayer_1` 到 `layer_32` 里起名。\n\n| 层 | 内容 | 它的 mask 勾选 |\n|---|---|---|\n| 1 world | 静态关卡 | 无 |\n| 2 player | 玩家身体 | 1 3 |\n| 3 enemy | 敌人身体 | 1 2 3 |\n| 4 player_hit | 玩家子弹与近战判定 `Area3D` | 3 |\n| 5 enemy_hit | 敌人攻击判定 `Area3D` | 2 |\n| 6 pickup | 拾取物 `Area3D` | 无 玩家的 `Area3D` 勾 6 |\n| 7 camera_block | 只给 `SpringArm3D` 用的墙体 | 无 |\n\n```gdscript\nextends CharacterBody3D\n\nconst LAYER_WORLD: int = 1 \u003C\u003C 0\nconst LAYER_PLAYER: int = 1 \u003C\u003C 1\nconst LAYER_ENEMY: int = 1 \u003C\u003C 2\n\n@export_flags_3d_physics var hit_mask: int = LAYER_ENEMY\n\nfunc _ready() -> void:\n\tcollision_layer = LAYER_PLAYER\n\tcollision_mask = LAYER_WORLD | LAYER_ENEMY\n```\n\n- `collision_layer` 是我在哪层，`collision_mask` 是我扫描哪层\n- 位掩码第 n 层是 `1 \u003C\u003C (n - 1)`，单层开关 `set_collision_mask_value(n, true)`\n- `Area3D` 检测不到谁，先查对方 layer 是否在自己的 mask 里\n\n### 空间查询\n\n| 需求 | 用这个 |\n|---|---|\n| 固定方向持续探测 地面 前方墙 | `RayCast3D` 节点 每物理帧自动更新 |\n| 同一物理帧改参数后立刻读 | `RayCast3D.force_raycast_update()` |\n| 点选 hitscan 一次性射线 | `intersect_ray()` |\n| 有厚度的探测 扫过一个形状 | `ShapeCast3D` 或 `cast_motion()` |\n| 某位置的范围内有谁 | `intersect_shape()` |\n| 两个形状是否相交与接触点 | `collide_shape()` 与 `get_rest_info()` |\n\n```gdscript\nextends Camera3D\n\nconst RAY_LENGTH: float = 1000.0\n\nfunc pick(mouse_position: Vector2) -> Dictionary:\n\tvar space: PhysicsDirectSpaceState3D = get_world_3d().direct_space_state\n\tvar from: Vector3 = project_ray_origin(mouse_position)\n\tvar to: Vector3 = from + project_ray_normal(mouse_position) * RAY_LENGTH\n\tvar query: PhysicsRayQueryParameters3D = PhysicsRayQueryParameters3D.create(from, to, 1 \u003C\u003C 2)\n\tquery.collide_with_areas = true\n\treturn space.intersect_ray(query)\n```\n\n- 结果是字典，没命中为空，有 `position` `normal` `collider` `rid` `shape`\n- `direct_space_state` 只在 `_physics_process()` 里访问，`_input()` 里只记鼠标位置\n\n### 第三人称相机\n\n节点结构：`Node3D` 枢轴，下面 `SpringArm3D`，下面 `Camera3D`。\n\n```gdscript\nextends Node3D\n\n@export var mouse_sensitivity: float = 0.003\n\n@onready var _arm: SpringArm3D = $SpringArm3D\n\nfunc _ready() -> void:\n\tvar body: CollisionObject3D = get_parent() as CollisionObject3D\n\tif body != null:\n\t\t_arm.add_excluded_object(body.get_rid())\n\nfunc _unhandled_input(event: InputEvent) -> void:\n\tvar motion: InputEventMouseMotion = event as InputEventMouseMotion\n\tif motion == null or Input.mouse_mode != Input.MOUSE_MODE_CAPTURED:\n\t\treturn\n\trotate_y(-motion.screen_relative.x * mouse_sensitivity)\n\t_arm.rotation.x = clampf(_arm.rotation.x - motion.screen_relative.y * mouse_sensitivity, -1.2, 1.2)\n```\n\n- `shape` 留空且相机是直接子节点时，用相机近平面做形状\n- `collision_mask` 默认第 1 层，玩家层在内又没排除时被自己顶短\n- 第一人称不用弹簧臂，yaw 转身体，pitch 转相机所在的头节点\n\n### 渲染器\n\n| 选这个 | 条件 |\n|---|---|\n| Forward+ | 桌面 3D 要 SDFGI VoxelGI SSR SSIL 体积雾 |\n| Mobile | 手机 一体机 XR 要 `CompositorEffect` 要光照投影 |\n| Compatibility | 网页 老硬件 简单 3D 与 2D |\n\n- 导出到网页只能用 Compatibility，切换后场景和环境要重调\n- 能力差异表见 [references\u002Frendering-lighting.md](references\u002Frendering-lighting.md)\n\n### 光照与 GI\n\n| 技术 | 渲染器 | 实时性 | 动态物体 | 工作量 |\n|---|---|---|---|---|\n| 无 GI 加环境光 | 全部 | 是 | 是 | 无 |\n| `ReflectionProbe` | 全部 | 更新模式 Once 或 Always | 接收 | 手摆 |\n| `LightmapGI` | 全部渲染 烘焙需 RenderingDevice | 否 | 靠 `LightmapProbe` | UV2 加烘焙 |\n| `VoxelGI` | 仅 Forward+ | 是 动态物体可发光 | 是 | 摆节点加烘焙 几秒 |\n| SDFGI | 仅 Forward+ | 半实时 | 只接收 | 环境里开关 |\n| SSIL | 仅 Forward+ | 是 | 是 | 环境里开关 只当补充 |\n\n- 桌面项目先开 SDFGI，不够再换\n- 手机只能 `LightmapGI` 加 `ReflectionProbe`\n- 由快到慢：`ReflectionProbe`、`LightmapGI`、`VoxelGI`、SSIL、SDFGI\n\n- 小型动态物体 `gi_mode` 设 Disabled，大型设 Dynamic，只对 VoxelGI 有效\n- `gi_mode`、灯的烘焙模式见 [references\u002Frendering-lighting.md](references\u002Frendering-lighting.md)\n\n### 环境与相机属性\n\n- `WorldEnvironment` 每个场景树只放一个，`Camera3D.environment` 优先\n- `Environment.tonemap_mode` 默认 Linear，亮部截断，换 Filmic、ACES 或 AgX 4.4+\n- `Camera3D.attributes` 优先于 `WorldEnvironment` 上的 `CameraAttributes`\n- `CameraAttributesPhysical` 覆盖相机 `fov` `near` `far`，拿不准用 `CameraAttributesPractical`\n- `tonemap_white` 取值、泛光阈值见 [references\u002Frendering-lighting.md](references\u002Frendering-lighting.md)\n\n### 场景导入与关卡\n\n- 格式优先 glTF 2.0，`.glb` 单文件；OBJ 没有骨骼、动画、PBR、UV2\n- Blender 对象名后缀决定导入结果，如 `-col` `-colonly` `-rigid` `-navmesh`\n- 动画名以 `loop` 或 `cycle` 开头或结尾自动循环\n- 改材质先 Extract Materials，加节点用继承场景\n- 网格拼装用 `GridMap` 加 `MeshLibrary`，CSG 只做灰盒\n- 后缀全表、MeshLibrary、CSG、运行时加载 glTF 见 [references\u002Fimport-and-levels.md](references\u002Fimport-and-levels.md)\n\n### 剔除与 LOD\n\n- 远处降面：导入的 glTF 默认生成 mesh LOD\n- 手做多级模型：`visibility_range_begin` `visibility_range_end`\n- 室内遮挡：开 `rendering\u002Focclusion_culling\u002Fuse_occlusion_culling`，加 `OccluderInstance3D` 烘焙\n- 完整做法与 `MultiMesh` 见 [references\u002Fculling-and-instancing.md](references\u002Fculling-and-instancing.md)\n\n### 导航\n\n```gdscript\nextends CharacterBody3D\n\n@export var speed: float = 4.0\n\n@onready var _agent: NavigationAgent3D = $NavigationAgent3D\n\nfunc go_to(target: Vector3) -> void:\n\t_agent.target_position = target\n\nfunc _physics_process(_delta: float) -> void:\n\tif NavigationServer3D.map_get_iteration_id(_agent.get_navigation_map()) == 0:\n\t\treturn\n\tif _agent.is_navigation_finished():\n\t\treturn\n\tvar next: Vector3 = _agent.get_next_path_position()\n\tvelocity = global_position.direction_to(next) * speed\n\tmove_and_slide()\n```\n\n- 场景放 `NavigationRegion3D` 加 `NavigationMesh`，下面放参与烘焙的网格，点 Bake\n- `NavigationMesh.cell_size` 与 `navigation\u002F3d\u002Fdefault_cell_size` 一致\n- 运行时烘焙用 `bake_navigation_mesh(true)`\n- 地图后台同步，进场头几帧 `map_get_iteration_id()` 为 0，先判断\n- `get_next_path_position()` 每物理帧调一次，到达后不再调\n- 避让：开 `avoidance_enabled`，连 `velocity_computed`，给 `velocity` 赋值，且设过 `target_position`\n\n### 骨骼修改器\n\n作为 `Skeleton3D` 的子节点，在动画之后运行。`influence` 做淡入淡出，`active` 开关。\n\n| 需求 | 节点 |\n|---|---|\n| 头、炮塔看向目标 | `LookAtModifier3D` 4.4+ |\n| 头发、布料、尾巴 | `SpringBoneSimulator3D` 4.4+ |\n| 手臂、腿两段 IK | `TwoBoneIK3D` 4.6+ |\n\n- `SkeletonIK3D` 已弃用\n- 全部修改器与版本见 [references\u002Fskeleton-modifiers.md](references\u002Fskeleton-modifiers.md)\n\n## 陷阱\n\n| 现象 | 做法 |\n|---|---|\n| `RayCast3D` 打不到其他层 | 节点 `collision_mask` 默认只有第 1 层，查询参数默认全部层 |\n| 射线打不到 `Area3D` | 设 `collide_with_areas` |\n| 射线从碰撞体内部出发不命中该体 | 设 `hit_from_inside` |\n| 查询命中自己 | `PhysicsRayQueryParameters3D` 自己填 `exclude`，只有 `RayCast3D` 有 `exclude_parent` |\n| 物理变慢或不稳 | 不平移旋转缩放 `CollisionShape3D`，改形状尺寸 |\n| 角色或刚体的三角网碰撞不工作 | `ConcavePolygonShape3D` 只用于静态体，改基本形状或凸包 |\n| 碰撞形状不生效 | `PhysicsBody3D` 只认直接子级的 `CollisionShape3D` |\n| `CharacterBody3D` 推不动 `RigidBody3D` | `move_and_slide()` 后对碰到的刚体 `apply_central_force`，方向取法线反向 |\n| 角色在斜坡抖动或飞出 | 先看 `floor_snap_length`，再看是否在 `_process` 里移动 |\n| 开物理插值后瞬移出现拖影 | 瞬移后调 `reset_physics_interpolation()` |\n| 阴影、GI、glow 显示不对 | 见 [references\u002Frendering-lighting.md](references\u002Frendering-lighting.md) 的阴影参数与环境 |\n\n## 参考\n\n- [references\u002Fcsharp.md](references\u002Fcsharp.md)：C# 项目先读，本文各节示例的 C# 写法\n- [references\u002Fphysics-3d.md](references\u002Fphysics-3d.md)：Jolt 差异、范围查询、ShapeCast3D\n- [references\u002Frendering-lighting.md](references\u002Frendering-lighting.md)：渲染器差异、灯、阴影、GI 烘焙\n- [references\u002Fimport-and-levels.md](references\u002Fimport-and-levels.md)：导入、后缀全表、GridMap、CSG、继承场景\n- [references\u002Fculling-and-instancing.md](references\u002Fculling-and-instancing.md)：LOD、遮挡、MultiMesh、Decal\n- [references\u002Fskeleton-modifiers.md](references\u002Fskeleton-modifiers.md)：骨骼修改器与版本\n- https:\u002F\u002Fdocs.godotengine.org\u002Fen\u002Fstable\u002Ftutorials\u002F3d\u002Findex.html\n- https:\u002F\u002Fdocs.godotengine.org\u002Fen\u002Fstable\u002Ftutorials\u002Fphysics\u002Fusing_jolt_physics.html\n- https:\u002F\u002Fdocs.godotengine.org\u002Fen\u002Fstable\u002Ftutorials\u002Frendering\u002Frenderers.html\n","# Godot 3D\n\n3D 场景用哪个节点、哪个资源、哪个项目设置，以及照直觉会写错的地方。\n\n## 范围\n\n| 不含 | 去哪 |\n|---|---|\n| 着色器、粒子、后处理 | godot-shaders-vfx |\n| 动画状态机、AnimationTree | godot-animation |\n| 2D 精灵放进 3D | godot-2d-in-3d |\n| 帧率剖析、大量实体 | godot-performance |\n\n## 先查内置\n\n| 需求 | 用这个 | 别自己写 |\n|---|---|---|\n| 角色走跑跳 | `CharacterBody3D` + `move_and_slide()` | 手算坡度和地面检测 |\n| 推得动的箱子、球 | `RigidBody3D`，一次性冲击 `apply_central_impulse`，持续推力 `apply_central_force` | 每帧改 `global_position` 或 `linear_velocity` |\n| 第三人称相机不穿墙 | `SpringArm3D` | 每帧射线加手动拉近 |\n| 点选 狙击 视线 | `PhysicsRayQueryParameters3D` + `intersect_ray()` | 遍历所有物体算相交 |\n| 前方探测 持续检测 | `RayCast3D` `ShapeCast3D` | 每帧 new 查询参数 |\n| 敌人寻路与避让 | `NavigationRegion3D` + `NavigationAgent3D` | 手写 A* 和路点 |\n| 大量相同网格 草 石头 | `MultiMeshInstance3D` | 几千个 `MeshInstance3D` |\n| 远处降面 | 导入时自动 mesh LOD | 脚本按距离换网格 |\n| 远处整组替换 淡出标签 | `GeometryInstance3D.visibility_range_end` | 脚本逐帧算距离 |\n| 室内遮挡 | `OccluderInstance3D` | 手动隐藏房间 |\n| 弹孔 污渍 假阴影 | `Decal` | 运行时拼贴图网格 |\n| 灰盒关卡 | CSG 节点 后转 `MeshInstance3D` | 把 CSG 带进发布版 |\n| 网格拼装关卡 | `GridMap` + `MeshLibrary` | 脚本循环摆几百个实例 |\n| 头部看向 尾巴发丝摆动 腿部 IK | 骨骼修改器 见下文版本表 | 每帧手改 `Skeleton3D` 骨骼姿态 |\n| 天空 雾 泛光 色调映射 | `WorldEnvironment` + `Environment` | 多个 `SubViewport` 堆后处理 |\n| 曝光 景深 | `CameraAttributesPractical` | 脚本改亮度 |\n| 间接光 | SDFGI VoxelGI LightmapGI | 到处摆补光灯 |\n| 导入后加碰撞 | 名字后缀 `-col` 或高级导入设置 | 导入后脚本遍历加 `CollisionShape3D` |\n| 高刷新率下相机抖动 | `physics\u002Fcommon\u002Fphysics_interpolation` | 自己在 `_process` 里插值 |\n\n## 做法\n\n### 角色移动\n\n```gdscript\nextends CharacterBody3D\n\n@export var speed: float = 5.0\n@export var jump_velocity: float = 4.5\n\nfunc _physics_process(delta: float) -> void:\n\tif not is_on_floor():\n\t\tvelocity += get_gravity() * delta\n\telif Input.is_action_just_pressed(\"jump\"):\n\t\tvelocity.y = jump_velocity\n\n\tvar input: Vector2 = Input.get_vector(\"move_left\", \"move_right\", \"move_forward\", \"move_back\")\n\tvar direction: Vector3 = global_basis * Vector3(input.x, 0.0, input.y)\n\tvelocity.x = direction.x * speed\n\tvelocity.z = direction.z * speed\n\tmove_and_slide()\n```\n\n- `velocity` 是每秒速度，不乘 `delta`\n- `get_vector` 长度已限制为 1，不再 `normalized()`，摇杆轻推保持慢速\n- `is_on_floor()` 读的是上一次 `move_and_slide()` 的结果\n- 相机相对移动时用相机的 yaw 基底代替 `global_basis`\n- 没有内置台阶，用斜面碰撞体，或 `ShapeCast3D` 自己检测\n- 重力方向不是 Y 时改 `up_direction`\n\n- 坡度、贴地、撞墙等属性默认值见 [references\u002Fphysics-3d.md](references\u002Fphysics-3d.md)\n\n### 物理引擎\n\n| 引擎 | 状态 |\n|---|---|\n| Jolt Physics | 4.4+ 内置，4.6 起新建项目默认，通常更快更稳 |\n| GodotPhysics3D | 设置值 `DEFAULT` 在 4.7 仍等于它，老项目升级后保持 |\n\n```ini\n[physics]\n\n3d\u002Fphysics_engine=\"Jolt Physics\"\n```\n\n- 4.5 及更早升级的项目手动改，改完重启编辑器\n- Jolt 与 GodotPhysics3D 的差异见 [references\u002Fphysics-3d.md](references\u002Fphysics-3d.md)\n\n### 碰撞层\n\n先列碰撞对再分层，在 `layer_names\u002F3d_physics\u002Flayer_1` 到 `layer_32` 里起名。\n\n| 层 | 内容 | 它的 mask 勾选 |\n|---|---|---|\n| 1 world | 静态关卡 | 无 |\n| 2 player | 玩家身体 | 1 3 |\n| 3 enemy | 敌人身体 | 1 2 3 |\n| 4 player_hit | 玩家子弹与近战判定 `Area3D` | 3 |\n| 5 enemy_hit | 敌人攻击判定 `Area3D` | 2 |\n| 6 pickup | 拾取物 `Area3D` | 无 玩家的 `Area3D` 勾 6 |\n| 7 camera_block | 只给 `SpringArm3D` 用的墙体 | 无 |\n\n```gdscript\nextends CharacterBody3D\n\nconst LAYER_WORLD: int = 1 \u003C\u003C 0\nconst LAYER_PLAYER: int = 1 \u003C\u003C 1\nconst LAYER_ENEMY: int = 1 \u003C\u003C 2\n\n@export_flags_3d_physics var hit_mask: int = LAYER_ENEMY\n\nfunc _ready() -> void:\n\tcollision_layer = LAYER_PLAYER\n\tcollision_mask = LAYER_WORLD | LAYER_ENEMY\n```\n\n- `collision_layer` 是我在哪层，`collision_mask` 是我扫描哪层\n- 位掩码第 n 层是 `1 \u003C\u003C (n - 1)`，单层开关 `set_collision_mask_value(n, true)`\n- `Area3D` 检测不到谁，先查对方 layer 是否在自己的 mask 里\n\n### 空间查询\n\n| 需求 | 用这个 |\n|---|---|\n| 固定方向持续探测 地面 前方墙 | `RayCast3D` 节点 每物理帧自动更新 |\n| 同一物理帧改参数后立刻读 | `RayCast3D.force_raycast_update()` |\n| 点选 hitscan 一次性射线 | `intersect_ray()` |\n| 有厚度的探测 扫过一个形状 | `ShapeCast3D` 或 `cast_motion()` |\n| 某位置的范围内有谁 | `intersect_shape()` |\n| 两个形状是否相交与接触点 | `collide_shape()` 与 `get_rest_info()` |\n\n```gdscript\nextends Camera3D\n\nconst RAY_LENGTH: float = 1000.0\n\nfunc pick(mouse_position: Vector2) -> Dictionary:\n\tvar space: PhysicsDirectSpaceState3D = get_world_3d().direct_space_state\n\tvar from: Vector3 = project_ray_origin(mouse_position)\n\tvar to: Vector3 = from + project_ray_normal(mouse_position) * RAY_LENGTH\n\tvar query: PhysicsRayQueryParameters3D = PhysicsRayQueryParameters3D.create(from, to, 1 \u003C\u003C 2)\n\tquery.collide_with_areas = true\n\treturn space.intersect_ray(query)\n```\n\n- 结果是字典，没命中为空，有 `position` `normal` `collider` `rid` `shape`\n- `direct_space_state` 只在 `_physics_process()` 里访问，`_input()` 里只记鼠标位置\n\n### 第三人称相机\n\n节点结构：`Node3D` 枢轴，下面 `SpringArm3D`，下面 `Camera3D`。\n\n```gdscript\nextends Node3D\n\n@export var mouse_sensitivity: float = 0.003\n\n@onready var _arm: SpringArm3D = $SpringArm3D\n\nfunc _ready() -> void:\n\tvar body: CollisionObject3D = get_parent() as CollisionObject3D\n\tif body != null:\n\t\t_arm.add_excluded_object(body.get_rid())\n\nfunc _unhandled_input(event: InputEvent) -> void:\n\tvar motion: InputEventMouseMotion = event as InputEventMouseMotion\n\tif motion == null or Input.mouse_mode != Input.MOUSE_MODE_CAPTURED:\n\t\treturn\n\trotate_y(-motion.screen_relative.x * mouse_sensitivity)\n\t_arm.rotation.x = clampf(_arm.rotation.x - motion.screen_relative.y * mouse_sensitivity, -1.2, 1.2)\n```\n\n- `shape` 留空且相机是直接子节点时，用相机近平面做形状\n- `collision_mask` 默认第 1 层，玩家层在内又没排除时被自己顶短\n- 第一人称不用弹簧臂，yaw 转身体，pitch 转相机所在的头节点\n\n### 渲染器\n\n| 选这个 | 条件 |\n|---|---|\n| Forward+ | 桌面 3D 要 SDFGI VoxelGI SSR SSIL 体积雾 |\n| Mobile | 手机 一体机 XR 要 `CompositorEffect` 要光照投影 |\n| Compatibility | 网页 老硬件 简单 3D 与 2D |\n\n- 导出到网页只能用 Compatibility，切换后场景和环境要重调\n- 能力差异表见 [references\u002Frendering-lighting.md](references\u002Frendering-lighting.md)\n\n### 光照与 GI\n\n| 技术 | 渲染器 | 实时性 | 动态物体 | 工作量 |\n|---|---|---|---|---|\n| 无 GI 加环境光 | 全部 | 是 | 是 | 无 |\n| `ReflectionProbe` | 全部 | 更新模式 Once 或 Always | 接收 | 手摆 |\n| `LightmapGI` | 全部渲染 烘焙需 RenderingDevice | 否 | 靠 `LightmapProbe` | UV2 加烘焙 |\n| `VoxelGI` | 仅 Forward+ | 是 动态物体可发光 | 是 | 摆节点加烘焙 几秒 |\n| SDFGI | 仅 Forward+ | 半实时 | 只接收 | 环境里开关 |\n| SSIL | 仅 Forward+ | 是 | 是 | 环境里开关 只当补充 |\n\n- 桌面项目先开 SDFGI，不够再换\n- 手机只能 `LightmapGI` 加 `ReflectionProbe`\n- 由快到慢：`ReflectionProbe`、`LightmapGI`、`VoxelGI`、SSIL、SDFGI\n\n- 小型动态物体 `gi_mode` 设 Disabled，大型设 Dynamic，只对 VoxelGI 有效\n- `gi_mode`、灯的烘焙模式见 [references\u002Frendering-lighting.md](references\u002Frendering-lighting.md)\n\n### 环境与相机属性\n\n- `WorldEnvironment` 每个场景树只放一个，`Camera3D.environment` 优先\n- `Environment.tonemap_mode` 默认 Linear，亮部截断，换 Filmic、ACES 或 AgX 4.4+\n- `Camera3D.attributes` 优先于 `WorldEnvironment` 上的 `CameraAttributes`\n- `CameraAttributesPhysical` 覆盖相机 `fov` `near` `far`，拿不准用 `CameraAttributesPractical`\n- `tonemap_white` 取值、泛光阈值见 [references\u002Frendering-lighting.md](references\u002Frendering-lighting.md)\n\n### 场景导入与关卡\n\n- 格式优先 glTF 2.0，`.glb` 单文件；OBJ 没有骨骼、动画、PBR、UV2\n- Blender 对象名后缀决定导入结果，如 `-col` `-colonly` `-rigid` `-navmesh`\n- 动画名以 `loop` 或 `cycle` 开头或结尾自动循环\n- 改材质先 Extract Materials，加节点用继承场景\n- 网格拼装用 `GridMap` 加 `MeshLibrary`，CSG 只做灰盒\n- 后缀全表、MeshLibrary、CSG、运行时加载 glTF 见 [references\u002Fimport-and-levels.md](references\u002Fimport-and-levels.md)\n\n### 剔除与 LOD\n\n- 远处降面：导入的 glTF 默认生成 mesh LOD\n- 手做多级模型：`visibility_range_begin` `visibility_range_end`\n- 室内遮挡：开 `rendering\u002Focclusion_culling\u002Fuse_occlusion_culling`，加 `OccluderInstance3D` 烘焙\n- 完整做法与 `MultiMesh` 见 [references\u002Fculling-and-instancing.md](references\u002Fculling-and-instancing.md)\n\n### 导航\n\n```gdscript\nextends CharacterBody3D\n\n@export var speed: float = 4.0\n\n@onready var _agent: NavigationAgent3D = $NavigationAgent3D\n\nfunc go_to(target: Vector3) -> void:\n\t_agent.target_position = target\n\nfunc _physics_process(_delta: float) -> void:\n\tif NavigationServer3D.map_get_iteration_id(_agent.get_navigation_map()) == 0:\n\t\treturn\n\tif _agent.is_navigation_finished():\n\t\treturn\n\tvar next: Vector3 = _agent.get_next_path_position()\n\tvelocity = global_position.direction_to(next) * speed\n\tmove_and_slide()\n```\n\n- 场景放 `NavigationRegion3D` 加 `NavigationMesh`，下面放参与烘焙的网格，点 Bake\n- `NavigationMesh.cell_size` 与 `navigation\u002F3d\u002Fdefault_cell_size` 一致\n- 运行时烘焙用 `bake_navigation_mesh(true)`\n- 地图后台同步，进场头几帧 `map_get_iteration_id()` 为 0，先判断\n- `get_next_path_position()` 每物理帧调一次，到达后不再调\n- 避让：开 `avoidance_enabled`，连 `velocity_computed`，给 `velocity` 赋值，且设过 `target_position`\n\n### 骨骼修改器\n\n作为 `Skeleton3D` 的子节点，在动画之后运行。`influence` 做淡入淡出，`active` 开关。\n\n| 需求 | 节点 |\n|---|---|\n| 头、炮塔看向目标 | `LookAtModifier3D` 4.4+ |\n| 头发、布料、尾巴 | `SpringBoneSimulator3D` 4.4+ |\n| 手臂、腿两段 IK | `TwoBoneIK3D` 4.6+ |\n\n- `SkeletonIK3D` 已弃用\n- 全部修改器与版本见 [references\u002Fskeleton-modifiers.md](references\u002Fskeleton-modifiers.md)\n\n## 陷阱\n\n| 现象 | 做法 |\n|---|---|\n| `RayCast3D` 打不到其他层 | 节点 `collision_mask` 默认只有第 1 层，查询参数默认全部层 |\n| 射线打不到 `Area3D` | 设 `collide_with_areas` |\n| 射线从碰撞体内部出发不命中该体 | 设 `hit_from_inside` |\n| 查询命中自己 | `PhysicsRayQueryParameters3D` 自己填 `exclude`，只有 `RayCast3D` 有 `exclude_parent` |\n| 物理变慢或不稳 | 不平移旋转缩放 `CollisionShape3D`，改形状尺寸 |\n| 角色或刚体的三角网碰撞不工作 | `ConcavePolygonShape3D` 只用于静态体，改基本形状或凸包 |\n| 碰撞形状不生效 | `PhysicsBody3D` 只认直接子级的 `CollisionShape3D` |\n| `CharacterBody3D` 推不动 `RigidBody3D` | `move_and_slide()` 后对碰到的刚体 `apply_central_force`，方向取法线反向 |\n| 角色在斜坡抖动或飞出 | 先看 `floor_snap_length`，再看是否在 `_process` 里移动 |\n| 开物理插值后瞬移出现拖影 | 瞬移后调 `reset_physics_interpolation()` |\n| 阴影、GI、glow 显示不对 | 见 [references\u002Frendering-lighting.md](references\u002Frendering-lighting.md) 的阴影参数与环境 |\n\n## 参考\n\n- [references\u002Fcsharp.md](references\u002Fcsharp.md)：C# 项目先读，本文各节示例的 C# 写法\n- [references\u002Fphysics-3d.md](references\u002Fphysics-3d.md)：Jolt 差异、范围查询、ShapeCast3D\n- [references\u002Frendering-lighting.md](references\u002Frendering-lighting.md)：渲染器差异、灯、阴影、GI 烘焙\n- [references\u002Fimport-and-levels.md](references\u002Fimport-and-levels.md)：导入、后缀全表、GridMap、CSG、继承场景\n- [references\u002Fculling-and-instancing.md](references\u002Fculling-and-instancing.md)：LOD、遮挡、MultiMesh、Decal\n- [references\u002Fskeleton-modifiers.md](references\u002Fskeleton-modifiers.md)：骨骼修改器与版本\n- https:\u002F\u002Fdocs.godotengine.org\u002Fen\u002Fstable\u002Ftutorials\u002F3d\u002Findex.html\n- https:\u002F\u002Fdocs.godotengine.org\u002Fen\u002Fstable\u002Ftutorials\u002Fphysics\u002Fusing_jolt_physics.html\n- https:\u002F\u002Fdocs.godotengine.org\u002Fen\u002Fstable\u002Ftutorials\u002Frendering\u002Frenderers.html\n",{"name":5,"description":7},"master","d9cc24874d2a7b2d0f9fa2382a02c42969a1e092","skills\u002Fgodot-3d",0,"https:\u002F\u002Fgithub.com\u002FMindsMaster\u002Fgodot-claude-code-skills","https:\u002F\u002Fgithub.com\u002FMindsMaster","Full-stack developer","2026-11-10 12:36:07",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add MindsMaster\u002Fgodot-claude-code-skills --skill godot-3d",{"tool":38,"command":39},"bunx","bunx skills add MindsMaster\u002Fgodot-claude-code-skills --skill godot-3d",{"tool":41,"command":42},"pnpm","pnpm dlx skills add MindsMaster\u002Fgodot-claude-code-skills --skill godot-3d","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMindsMaster\u002Fgodot-claude-code-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fgodot-3d\u002FSKILL.md",true,[46,52,56,60,64,68],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"references\u002Fcsharp.md","REFERENCE","参考文档",3921,"https:\u002F\u002Fgithub.com\u002FMindsMaster\u002Fgodot-claude-code-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fgodot-3d\u002Freferences\u002Fcsharp.md",{"path":53,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":54,"sourceHtmlUrl":55},"references\u002Fculling-and-instancing.md",9412,"https:\u002F\u002Fgithub.com\u002FMindsMaster\u002Fgodot-claude-code-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fgodot-3d\u002Freferences\u002Fculling-and-instancing.md",{"path":57,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":58,"sourceHtmlUrl":59},"references\u002Fimport-and-levels.md",9500,"https:\u002F\u002Fgithub.com\u002FMindsMaster\u002Fgodot-claude-code-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fgodot-3d\u002Freferences\u002Fimport-and-levels.md",{"path":61,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":62,"sourceHtmlUrl":63},"references\u002Fphysics-3d.md",6990,"https:\u002F\u002Fgithub.com\u002FMindsMaster\u002Fgodot-claude-code-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fgodot-3d\u002Freferences\u002Fphysics-3d.md",{"path":65,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":66,"sourceHtmlUrl":67},"references\u002Frendering-lighting.md",8551,"https:\u002F\u002Fgithub.com\u002FMindsMaster\u002Fgodot-claude-code-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fgodot-3d\u002Freferences\u002Frendering-lighting.md",{"path":69,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":70,"sourceHtmlUrl":71},"references\u002Fskeleton-modifiers.md",6273,"https:\u002F\u002Fgithub.com\u002FMindsMaster\u002Fgodot-claude-code-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fgodot-3d\u002Freferences\u002Fskeleton-modifiers.md",[73,80,87,94,101,108],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7FBP7NJ4NTGA239X15MXQPK","godot-ui","写菜单 HUD 对话框 血条 设置界面 本地化 分辨率适配 UI 导航时用，做设置即时生效 窗口模式 全屏 窗口尺寸确认还原 失焦暂停时也用。Control 布局 Container anchors、项目级 Theme 统一字体、StyleBox、ProgressBar 血条、RichTextLabel、多分辨率 stretch aspect、tr() 本地化、手柄焦点导航、mouse_filter 吃点击、CanvasLayer HUD、弹窗 拖放。UI layout, theme, localization, settings menu, fullscreen, pause on focus loss.","https:\u002F\u002Fgithub.com\u002FMindsMaster\u002Fgodot-claude-code-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fgodot-ui\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7FBP23RTBQ2ZW9SKXE37SFS","godot-shaders-vfx","做受击闪白 受伤变白 命中闪烁 溶解 描边，或从 GDScript 与 C# 改 .gdshader 的 shader 参数 SetInstanceShaderParameter set_shader_parameter 时先用，多个敌人共用一份材质各自闪白也归这里。也管内置材质与 shader 的取舍、instance uniform、屏幕与深度纹理、GPUParticles 粒子、后处理顺序。shaders, hit flash, particles, post-processing.","https:\u002F\u002Fgithub.com\u002FMindsMaster\u002Fgodot-claude-code-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fgodot-shaders-vfx\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M7FBNVCNBKPFGQF5P5QJZMXK","godot-scene-authoring","在 Godot 4 里新做关卡、房间、HUD、菜单、NPC、道具、背景时用，决定内容摆进 .tscn 还是代码运行时搭。新建项目第一个场景，往已有项目加场景，打开场景一片空看不到东西，美术策划要在编辑器里直接看和调，自定义显示节点在编辑器里不显示，@tool 节点把材质 z_index 写进 tscn，确定性模拟 联机 服务器要读场景里摆的位置。先自查项目是摆在场景里还是运行时生成，再按结果新做或迁移。脚本生成 tscn、@tool 自绘节点、预制场景、_validate_property、internal 子节点、NOTIFICATION_EDITOR_PRE_SAVE、C# 重载。level authoring, WYSIWYG, prefab, data-driven, bake on save, empty scene, audit.","https:\u002F\u002Fgithub.com\u002FMindsMaster\u002Fgodot-claude-code-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fgodot-scene-authoring\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":19},"01M7FBNN4WFN0PHM6P7SDH7V0J","godot-scene-architecture","拆分 Godot 4 场景与组织节点时用。PackedScene 组件复用、节点引用 @onready @export %UniqueName、信号与直接调用的选择、分组 call_group、Autoload 与普通节点、组合与继承、状态机、暂停 process_mode、queue_free 与 is_instance_valid、_ready 顺序、场景切换。scene tree architecture, signals, autoload.","https:\u002F\u002Fgithub.com\u002FMindsMaster\u002Fgodot-claude-code-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fgodot-scene-architecture\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":19},"01M7FBNFF1K8A77X45BDBQCA6E","godot-resources-data","定义游戏数据表 配置 存档 资源加载时用。自定义 Resource class_name @export .tres 与 C# [GlobalClass]、JSON 与 Resource 怎么选、导入时把 JSON CSV 转成 Resource、资源共享与 duplicate local_to_scene、load preload 与线程加载进度条、user:\u002F\u002F 存档、导出后读不到 res:\u002F\u002F 目录。game data, custom resource, save game.","https:\u002F\u002Fgithub.com\u002FMindsMaster\u002Fgodot-claude-code-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fgodot-resources-data\u002FSKILL.md",[],[],{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":19},"01M7FBNB7C2A6XE5E48XH5NC5D","godot-performance","排查卡顿 掉帧 帧率低 内存增长时用，也用于几百个怪物 子弹同屏、CharacterBody 拥挤变慢、每帧重建网格、线程池只用上两三个核、C# 跨界开销。先测再改 Profiler Monitors。不降画面与数量的内置解法 管理器统一驱动、MultiMesh、Server、对象池、空间哈希、WorkerThreadPool 分块、网格局部更新、物理插值、线程加载、着色器编译卡顿、每帧分配。Godot performance, stutter, many entities.","https:\u002F\u002Fgithub.com\u002FMindsMaster\u002Fgodot-claude-code-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fgodot-performance\u002FSKILL.md",[],[]]