fs-gg-collision

Detect and resolve box, circle, and polygon collisions in two-dimensional space.

Updated Jul 6, 2026
One-click install
npx skills add https://github.com/FS-GG/FS.GG.Game --skill fs-gg-collision
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fs-gg-collision
Source: https://github.com/FS-GG/FS.GG.Game/tree/main/template/product-skills/fs-gg-collision
Command: npx skills add https://github.com/FS-GG/FS.GG.Game --skill fs-gg-collision

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill unit addresses the challenges of collision detection and resolution in FS.GG UI products, offering deterministic and efficient broad-phase and narrow-phase collision handling.

Core Features & Use Cases

  • Narrow-phase Collision Detection: Determines overlaps and penetration depth between shapes using detectors like aabbContact, circleContact, and polygonContact.
  • Broad-phase Collision Pruning: Utilizes SpatialGrid for efficient broad-phase queries to reduce unnecessary narrow-phase computations.
  • Response to Collisions: Calculates and applies collision responses like pushing objects apart and sliding objects along surfaces.
  • Use Case: In a game or simulation built with the FS.GG platform, use this Skill to ensure that objects in the UI interact with each other realistically and according to physical laws.

Quick Start

Implement the resolvePass function to handle collisions for your game, which includes building the SpatialGrid and querying it for nearby bodies, followed by determining and applying the appropriate collision responses.

Frequently Asked Questions about fs-gg-collision

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle 2D collision detection and resolution for circles and polygons?

2D collision detection and resolution for circles, boxes, and polygons is handled by calculating overlaps and penetration depth using narrow-phase detectors like aabbContact, circleContact, and polygonContact. The system then applies appropriate physical responses to push objects apart.

What is the difference between broad-phase and narrow-phase collision detection?

Broad-phase collision detection uses a SpatialGrid to efficiently query nearby bodies and prune unnecessary checks, while narrow-phase collision detection determines exact overlaps and penetration depth between specific shapes. Combining both reduces computation for high-performance simulations.

How do I implement collision resolution to push objects apart and slide them along surfaces?

Collision resolution to push objects apart and slide them is implemented via the resolvePass function. This function builds the SpatialGrid, queries nearby bodies, determines overlaps, and calculates the appropriate collision responses to apply.

Does this collision detection system support deterministic simulations for FS.GG UI products?

Yes, this collision detection system is specifically designed for deterministic simulations within FS.GG UI products. It integrates with FS.GG Game.Core to ensure objects interact realistically and according to physical laws in a two-dimensional space.

Can I use spatial partitioning to improve collision detection performance for high-volume simulations?

Yes, you can use spatial partitioning to improve performance through the built-in SpatialGrid broad-phase mechanism. It efficiently prunes unnecessary narrow-phase computations, making it suitable for deterministic and high-performance simulations.

What are the limitations of using a SpatialGrid for broad-phase collision pruning?

The SpatialGrid handles broad-phase collision pruning to reduce narrow-phase computations for box, circle, and polygon shapes. It is optimized for high-performance 2D simulations within the FS.GG Game.Core architecture rather than arbitrary non-2D spatial configurations.