build_body_collider
Builds a feet-aligned RectangleShape2D or CapsuleShape2D body collider for moving characters by analyzing animation frames, filtering thin limbs, and returning ready-to-use Godot collision snippets.
Instructions
Build a stable single-shape body collider for a moving character.
This is the recommended collision tool for player/enemy movement. It consumes all frames of one animation, overlays their alpha masks, measures the full character height and a thickness-filtered body width, and returns a feet-aligned RectangleShape2D (default) or CapsuleShape2D. The older extract_collision_polygon tool remains available for static objects.
Args:
image_path: Path or res:// URI to the spritesheet image.
frames: Every frame region of the selected animation, for example
[{"x": 0, "y": 264, "w": 66, "h": 66}, ...]. All frames must
have the same width and height.
shape: "rectangle" (default) or "capsule". Wide bodies such as
slimes use a rotated capsule automatically when capsule is chosen.
alpha_threshold: Pixels with alpha strictly greater than this are
opaque. Defaults to 10.
thickness_ratio: A column must have at least this fraction of the
character height to count as core body. Defaults to 0.30, which
filters thin weapons and arms.
project_root: Optional Godot project root directory for resolving
res:// URIs.
Returns:
A JSON-compatible dictionary containing height/top/bottom, filtered
body width and raw width, sprite_offset for the AnimatedSprite2D,
collision_position (feet at origin), shape parameters, and
ready-to-paste sub-resource and CollisionShape2D snippets.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| shape | No | rectangle | |
| frames | Yes | ||
| image_path | Yes | ||
| project_root | No | ||
| alpha_threshold | No | ||
| thickness_ratio | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||