Godot 2d Physics logo

Godot 2d Physics

Community
thedivergentai
godot-2d-physics

Expert patterns for Godot 2D physics including collision layers/masks, Area2D triggers, raycasting, and PhysicsDirectSpaceState2D queries. Use when implementing collision detection, trigger zones, line-of-sight systems, or manual physics queries. Trigger keywords: CollisionShape2D, CollisionPolygon2D, collision_layer, collision_mask, set_collision_layer_value, set_collision_mask_value, Area2D, body_entered, body_exited, RayCast2D, force_raycast_update, PhysicsPointQueryParameters2D, PhysicsShapeQueryParameters2D, direct_space_state, move_and_collide, move_and_slide.

Overview

Publisherthedivergentai
RepositoryGD-Agentic-Skills
Skill namegodot-2d-physics
Stars
727
Forks
43
Bundled files
30
LicenseLGPL-3.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 30 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by thedivergentai on GitHub. Read the source before you install it.

Installation

Install the Godot 2d Physics AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/thedivergentai/GD-Agentic-Skills.git /tmp/GD-Agentic-Skills
mkdir -p .claude/skills
cp -r /tmp/GD-Agentic-Skills/skills/godot-2d-physics .claude/skills/godot-2d-physics
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Godot 2d Physics in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Godot 2d Physics on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Godot 2d Physics is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

2D Physics

Expert guidance for collision detection, triggers, and raycasting in Godot 2D.

NEVER Do

  • NEVER scale CollisionShape2D nodes — Use the shape handles in the editor, NOT the Node2D scale property. Scaling causes unpredictable physics behavior and incorrect collision normals [12].
  • NEVER confuse collision_layer with collision_mask — Layer = "What AM I?", Mask = "What do I DETECT?". Setting both to the same value is usually wrong [13].
  • NEVER multiply velocity by delta when using move_and_slide()move_and_slide() automatically includes timestep. Only multiply gravity/acceleration by delta [14].
  • NEVER forget force_raycast_update() for manual mid-frame raycasts — Raycasts update once per physics frame. If you change target_position, you MUST force an update [15].
  • NEVER use get_overlapping_bodies() every frame — It is expensive. Cache results with body_entered/body_exited signals instead [16].
  • NEVER modify RigidBody2D state directly in _process — Use _integrate_forces() for safe, synchronized access to PhysicsDirectBodyState2D [17, 411].
  • NEVER move PhysicsBody2D nodes in _process() — Use _physics_process(). Moving bodies outside the physics step causes stutter and unreliable collision detection.
  • NEVER use RigidBody2D for 1000+ simple entities — Use PhysicsServer2D to bypass node overhead for massive performance gains (Swarms/Bullets) [18, 397].
  • NEVER use Area2D for high-frequency blocking (Bullets) — Area signals can be delayed. Use move_and_collide() or ShapeCast2D for frame-perfect results [19].
  • NEVER ignore 'Physics Jitter' on high-refresh monitors — Enable Physics Interpolation to prevent micro-stutter in motion [21, 400].
  • NEVER scale collision shapes directly at runtime — It causes major instability. Resize the shape resource (size/radius) instead.
  • NEVER use set_deferred for immediate physics transform logic — It happens at the end of the frame. Use force_raycast_update() or PhysicsServer2D instead.
  • NEVER leave Continuous CD (CCD) enabled for slow objects — It adds significant CPU overhead. Reserve it for high-speed projectiles to prevent tunneling.
  • NEVER use a single collision layer for all tiles/entities — Separate layers (Ground, Walls, Enemies) to allow selective filtering via masks.
  • NEVER forget to free PhysicsServer2D RIDs manually — They are not garbage collected and will leak memory permanently.

Available Scripts

MANDATORY: Read the script matching your workflow branch before coding. Query/Area cookbook samples live in scripts — not in this body.

Workflow router (MANDATORY / Do NOT Load)

BranchLoadDo NOT Load
Layer/mask matrix setupcollision_bitmask_helper.gd or collision_setup.gd; matrix policy → collision_layer_matrix_manager.gdSwarm / CCD scripts
LOS / vision conesraycast_vision_stack.gd (+ physics_direct_query.gd for nodeless rays)shapecast_aoe*.gd, physics_server_swarm.gd
AOE / melee volumePrefer shapecast_aoe.gd (faction mask); ground/volume sensing → shapecast_aoe_detection.gdArea2D spam + lava DoT tutorials; do not load both shapecast scripts for the same feature
Hitscan / point pick / one-shot shapephysics_queries.gd (canonical). Specialists: physics_direct_space_query.gd (LOS bool), raycast_hit_prediction.gdRe-load all three query helpers at once
Bullet hell / 1000+ bodiesMANDATORY physics_server_swarm.gd (+ physics_server_direct_body.gd for RID shapes)Per-bullet Area2D / RigidBody2D nodes
High-speed tunnelingcontinuous_collision_detection.gd + substepping_logic.gdCCD on slow props
RigidBody safe mutatesafe_rigidbody_state.gd (_integrate_forces)Direct transform writes in _process
Custom CharacterBody forcescustom_physics_2d.gdcustom_physics.gd (that file is RigidBody _integrate_forces)
Gravity zonescustom_gravity_area.gd (Area override) or custom_gravity_override.gd (character weight/zones)Both unless you need Area + character paths
Overlap signal spamcollision_debouncer.gdPolling get_overlapping_bodies every frame
Compound multi-shape RIDcompound_body_sync.gdMultiple nodes for one logical body
Debug contact normalscollision_visual_debugger.gdVisible collision menu insufficient
High-refresh jitterPrefer jitter_interpolation_fix.gdphysics_interpolation_smoothing.gd (legacy/manual; only if built-in interpolation is unavailable)
Precision bounce / slidemove_and_collide_precision.gd
Batch static moversperformance_batch_mover.gd
Query result cachephysics_query_cache.gdDuplicate space queries same frame

Canonical vs overlap (dedupe guide)

  • ShapeCast AOE: load shapecast_aoe.gd for combat AOE; shapecast_aoe_detection.gd only for grounded/volume checks — never both for one feature.
  • Space queries: start with physics_queries.gd; add physics_direct_query.gd / physics_direct_space_query.gd only if that specialist matches.
  • Custom physics: CharacterBody → custom_physics_2d.gd; RigidBody integrate → custom_physics.gd.
  • Interpolation: jitter_interpolation_fix.gd wins over physics_interpolation_smoothing.gd.

Script index


Decision Tree: Collision Detection Methods

Use CaseMethodWhy / script
Continuous trigger zoneArea2D + signalsMemory of occupants; debounce with collision_debouncer.gd
One-time pickupArea2D + queue_free on enterSimple cleanup
Line-of-sightRayCast2D / direct rayraycast_vision_stack.gd or physics_direct_query.gd
Click-to-selectPhysicsPointQueryParameters2Dphysics_queries.gd
AOE spell / melee volumeShapeCast2D / shape queryshapecast_aoe.gd (not Area signal lag)
Instant-hit weaponPhysicsRayQueryParameters2Dphysics_queries.gd / raycast_hit_prediction.gd
Platformer ground / ledgeRay or ShapeCast downCharacterBody skill + shapecast_aoe_detection.gd
1000+ projectilesPhysicsServer2D RIDsMANDATORY physics_server_swarm.gd

Mental model (keep short)

  • Layer = who I am; Mask = who I detect. Bitmask cookbook → collision-layers-masks.md.
  • Area2D with multiple shapes fires body_entered once per shape — dedupe with a Set/dict or collision_debouncer.gd.
  • Mid-frame ray/shape changes require force_raycast_update() / force_shapecast_update().
  • _ready physics queries are false until after a physics frame (await get_tree().physics_frame).
  • CharacterBody2D ships with collision_layer = 0 — Areas won't see it until you set a layer.
  • Free PhysicsServer RIDs yourself — they are not GC'd.

Deep recipes (on demand)

TopicReference / script
Layer/mask patternscollision-layers-masks.md
Area2D, raycast, shape queriesarea2d-and-queries.md
Compound RID bodiescompound_body_sync.gd
Contact normal debug drawcollision_visual_debugger.gd

Reference

Progressive disclosure: open Official Documentation links only when researching a specific API; load Related Skills when routing work to a peer domain — do not preload the whole lattice.

Official Documentation

  • Physics introduction — Collision layers vs masks, body types, and the mental model every 2D setup depends on.
  • Collision shapes (2D) — Correct shape sizing and why scaling CollisionShape2D nodes breaks normals and contacts.
  • Using CharacterBody2Dmove_and_slide / move_and_collide, floor detection, and kinematic movement contracts.
  • Using Area2D — Trigger monitoring, overlap signals, and space/gravity overrides for zones.
  • Ray-castingRayCast2D vs PhysicsDirectSpaceState2D rays, exclusions, and mid-frame force_raycast_update.
  • RigidBody — Safe rigid-body control via _integrate_forces / PhysicsDirectBodyState2D instead of fighting the solver in _process.
  • Troubleshooting physics issues — Tunneling, jitter, one-way platforms, and common layer/mask misconfigurations.
  • Physics interpolation introduction — Why fixed physics ticks stutter on high-refresh displays and when interpolation fixes it.
  • PhysicsServer2D — RID-based body/shape APIs for swarm-scale 2D physics without SceneTree overhead.
  • PhysicsDirectSpaceState2D — Point, ray, and shape queries for LOS, AOE, and click-picking without permanent query nodes.
  • ShapeCast2D — Volume casts for frame-perfect melee/AOE detection when Area2D signal lag is unacceptable.

Related Skills

Prerequisites
  • godot-project-foundations — Project Settings layer names, physics ticks, and default gravity must be set before layer/mask matrices stay sane.
  • godot-gdscript-mastery — Bitmask enums, typed dictionaries for overlap sets, and _physics_process discipline underpin every pattern here.
  • godot-signal-architecturebody_entered / body_exited wiring and debounce patterns need clean signal ownership to avoid spam.
Complements
  • godot-characterbody-2d — Coyote time, jump buffers, and one-way platforms sit on top of the collision contracts this skill defines.
  • godot-raycasting-queries — Deeper query parameter recipes (exclusions, masks, shape casts) when vision/hitscan systems grow beyond basics.
  • godot-tilemap-mastery — Tile physics layers and one-way tile collisions must match the same layer matrix used by bodies and areas.
  • godot-input-handling — Physics-step input sampling and vsync/latency choices couple tightly with move_and_slide feel.
  • godot-physics-3d — Parallel 3D body/query concepts when porting or sharing layer policy across dimensions.
  • godot-performance-optimization — Profiling and batching guidance when PhysicsServer2D swarms or query caches become bottlenecks.
  • godot-debugging-profiling — Visible collision shapes, contact normals, and frame-time traps when diagnosing jitter or missed hits.
Downstream / consumers
  • godot-combat-system — Hitboxes/hurtboxes are Area2D + layer/mask products; damage timing inherits overlap and CCD choices.
  • godot-genre-platformer — Platformer feel (floors, ledges, one-ways) consumes CharacterBody2D + collision setup from this domain.
  • godot-navigation-pathfinding — Agents still need physics layers for blockers and LOS; keep nav meshes and collision worlds consistent.
  • godot-monte-carlo-balancer — Jump windows, projectile speed/CCD, gravity, and hitbox size directly change win-rate and difficulty curves; simulate those physics knobs instead of guessing.
Master
  • godot-master — Library router and mirrored entry point for discovering 2D physics alongside sibling domains.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Godot 2d Physics AI skill do?

Expert patterns for Godot 2D physics including collision layers/masks, Area2D triggers, raycasting, and PhysicsDirectSpaceState2D queries. Use when implementing collision detection, trigger zones, line-of-sight systems, or manual physics queries. Trigger keywords: CollisionShape2D, CollisionPolygon2D, collision_layer, collision_mask, set_collision_layer_value, set_collision_mask_value, Area2D, body_entered, body_exited, RayCast2D, force_raycast_update, PhysicsPointQueryParameters2D, PhysicsShapeQueryParameters2D, direct_space_state, move_and_collide, move_and_slide.

Why use Godot 2d Physics on TypingMind?

Because you install it once and use it with any model. Godot 2d Physics is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Godot 2d Physics in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/thedivergentai/GD-Agentic-Skills/tree/main/skills/godot-2d-physics. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Godot 2d Physics?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Godot 2d Physics?

As many as you like. As long as a model supports skills, you can use Godot 2d Physics with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Godot 2d Physics AI skill free?

Yes. It is published on GitHub by thedivergentai under the LGPL-3.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇