godot-physics-rb0v

针对 GodotPhysics 的专用技能,旨在帮助 AI Agent 高效完成相关任务。

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "godot-physics-rb0v":https://skillpi.com/zh/skills/deepskill-163637e352bd81ed4c16a48fd53a24bdce46c4833294863d7ea7efd03574f512。安装前核对上游来源和版本:https://skillhub.cn/skills/user_3c6cb52e/godot-physics-rb0v。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

skillhub.cn

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

针对 GodotPhysics 的专用技能,旨在帮助 AI Agent 高效完成相关任务。

0 下载

介绍来源: third_party · user_3c6cb52e · 1.0.0 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
翻译待完成,请参阅来源文档。
输入和输出
来源文档未说明。
软件、账号及付费要求
来源文档未说明。
限制与区别
来源文档未说明。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: Godotphysics
slug: godot-physics
version: 1.0.0
displayName: Godotphysics
description: >
  GodotPhysics专用技能,帮助AI Agent高效完成相关任务。
summary: "GodotPhysics专用技能,帮助AI Agent高效完成相关任务。"
license: Apache-2.0
category: 游戏开发
framework:
  - Claude Code
  - Codex
  - Hermes Agent
  - OpenClaw
  - QClaw
  - WorkBuddy
platform: multi-platform
homepage: https://github.com/1991513ccie-png
repository: https://github.com/1991513ccie-png

Godot Physics (4.x, 2D + 3D)

Pick the right physics body, wire up collision layers/masks, detect overlaps, and cast rays. Concepts apply to both 2D and 3D (swap the 2D/3D suffix). Targets Godot 4.3+.

When to use

  • Use when choosing between body types, setting collision layers/masks so the right things collide, detecting overlaps (triggers, hurtboxes) with Area, applying forces/impulses to a RigidBody, or casting rays for line-of-sight/ground checks.

When not to use: kinematic character controllers (move_and_slide) → godot-2d-movement; tile collision setup → godot-tilemap; tuning the feel of physics (timestep, mass, jitter) → physics-tuning.

Core workflow

  1. Choose the body type:
    • StaticBody — never moves (floors, walls). Collides, no simulation.
    • RigidBody — fully simulated (gravity, forces, bouncing). Don't set its position directly; apply forces/impulses or set linear_velocity.
    • CharacterBody — script-driven kinematic (see godot-2d-movement).
    • Area — detects overlaps and can apply gravity/damping; no solid collision. Every body needs a CollisionShape (or CollisionPolygon) child.
  2. Configure layers and masks. A body is on its layers and scans for its masks. Two bodies interact only if one's layer is in the other's mask. Name layers in Project Settings > Layer Names for clarity.
  3. Detect overlaps with Area signals (body_entered, area_entered).
  4. Drive RigidBodies with forces/impulses, or override _integrate_forces for full control.
  5. Cast rays with a RayCast2D/3D node (polled each frame) or a one-shot space-state query from code.

Patterns

1. Collision layers vs masks (set from code)

# Player is on layer 1, scans layers 2 (walls) and 3 (enemies).
func _ready() -> void:
    set_collision_layer_value(1, true)    # I am on layer 1
    set_collision_mask_value(2, true)     # I collide with things on layer 2
    set_collision_mask_value(3, true)     # ...and layer 3
    # Bit-field forms also exist: collision_layer = 1; collision_mask = 0b110

2. Area2D as a trigger / hurtbox

extends Area2D                            # e.g. a damage zone

func _ready() -> void:
    body_entered.connect(_on_body_entered)
    area_entered.connect(_on_area_entered)

func _on_body_entered(body: Node2D) -> void:
    if body.has_method("take_damage"):
        body.take_damage(10)

func _on_area_entered(area: Area2D) -> void:
    print("Overlapped area: ", area.name)

3. Applying force and impulse to a RigidBody3D

extends RigidBody3D

func push(direction: Vector3) -> void:
    apply_central_impulse(direction * 8.0)     # instantaneous velocity change

func _physics_process(_delta: float) -> void:
    apply_central_force(Vector3.FORWARD * 4.0) # continuous force (per tick)
    # Never set `position` on a RigidBody to move it; use forces/impulses or
    # set linear_velocity. Use freeze=true if you must hold it in place.

4. Raycast two ways

# A) RayCast2D node: enable it, then poll after physics has updated.
@onready var ray: RayCast2D = $RayCast2D    # set target_position in the editor

func _physics_process(_delta: float) -> void:
    if ray.is_colliding():
        var hit := ray.get_collider()
        var point := ray.get_collision_point()

# B) One-shot query from code (no node needed).
func ground_under(global_from: Vector2) -> Dictionary:
    var space := get_world_2d().direct_space_state
    var query := PhysicsRayQueryParameters2D.create(global_from, global_from + Vector2(0, 64))
    query.collision_mask = 1                 # only layer 1
    return space.intersect_ray(query)        # {} if nothing hit, else collider/position/normal

Pitfalls

  • Layer vs mask confusion is the #1 bug. Layer = "what I am"; mask = "what I look for". For A to detect B, B's layer must be in A's mask. Detection can be one-directional.
  • Moving a RigidBody by position fights the solver and causes tunneling/jitter. Use impulses/forces, set linear_velocity, or freeze it. To teleport, set position and zero the velocities inside _integrate_forces.
  • Area doesn't fire when neither monitoring nor monitorable is set, or layers/masks don't overlap. monitoring must be on for the Area to detect; monitorable lets others detect it.
  • RayCast2D/3D read stale or no data if enabled is false, or if you read it before physics updated — read in _physics_process, and call force_raycast_update() after moving it within the same tick.
  • Forgetting a CollisionShape (or leaving it empty) means the body never collides.
  • Fast objects tunnel through thin walls; enable continuous CD on the RigidBody (continuous_cd) or use a raycast-based check.
  • intersect_ray excludes its own body? Pass query.exclude = [self.get_rid()] (an Array[RID], not an array of nodes) to skip self-hits.

References

  • For _integrate_forces, joints, one-way collision, PhysicsServer direct access, shape queries (intersect_shape), and 3D move_and_collide, read references/bodies-and-queries.md.

Related skills

  • godot-2d-movement — kinematic CharacterBody2D controllers.
  • godot-tilemap — tile collision shapes and their layers.
  • physics-tuning — engine-agnostic feel: timestep, mass, drag, CCD.
  • godot-3d-essentials — 3D scene setup these bodies live in.

当前收录版本

1.0.0

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值88/100

亮点

  • 提供 Godot 4.x 物理系统完整工作流,覆盖 2D/3D 场景
  • 针对游戏开发者明确需求,解决碰撞层、射线检测等常见痛点
  • 包含具体代码模式和陷阱提示,实用性强
触发精准92/100

亮点

  • description 明确界定用途为 GodotPhysics 专用技能
  • When to use 章节清晰说明适用范围和边界条件
  • 覆盖 Godot 物理核心场景:body 类型、collision layers、Area 触发、RigidBody 力控、raycast
结构规范95/100

待提升项

  • 缺少独立 When to Use 章节标题 原报告严重程度:轻微

    When to use 内容存在但未用 ## 标题明确分隔,影响结构清晰度

    改进建议:建议将 When to use 内容提升为独立二级标题 ## When to Use

亮点

  • Core workflow 五步流程清晰,Patterns 提供具体实现示例
  • frontmatter 完整,包含所有必要元数据字段
  • 单文件约 450 行,长度合理
执行可靠90/100

待提升项

  • Godot 版本兼容性说明不足 原报告严重程度:轻微

    文档提到 Godot 4.3+,但未显式说明与 Godot 3.x 的 API 差异

    改进建议:建议在开头或 Pitfalls 部分补充 Godot 3.x 与 4.x 的 API 变更说明

亮点

  • 工具来源明确:基于 Godot 官方 API(RigidBody/Area/RayCast)
  • 参数使用正确:collision_layer_value、apply_central_impulse、intersect_ray
  • 覆盖主要异常场景:layer/mask 混淆、RigidBody 位置设置、Area 不触发、raycast 时序
证据可验 (前四项均值)91/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

文档引用的域名或地址

这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。

  • github.com

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

来源文档未说明。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。