classic-physics

Documents collision detection, interaction dispatch, and A* pathfinding for the classic-wgl Rust engine.

1|1|Updated Aug 18, 2021
One-click install
npx skills add https://github.com/guilledk/classic-wgl --skill classic-physics-guilledk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: classic-physics
Source: https://github.com/guilledk/classic-wgl/tree/main/.agents/skills/classic-physics
Command: npx skills add https://github.com/guilledk/classic-wgl --skill classic-physics-guilledk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working on classic-wgl's physics and pathfinding systems requires understanding a dense set of interacting mechanisms — PhysicsProvider lifecycle, click/enter/exit dispatch, GJK collision tests, quadtree partitioning, and A* search — whose behavior is spread across multiple crates and easy to get wrong. ## Core Features & Use Cases - Physics Lifecycle Reference: Explains the exact per-frame sequence (resize_screen, begin_frame, perform_calls, update_hover) and the rules for collider registration, enabled state, and virtual colliders (mouse PID 0, selection PID 1). - Interaction Dispatch Semantics: Details click priority sorting, consumes_click pre-scan, enter/exit transition detection, and drag-selection rectangle handling. - Algorithm Internals: Covers the GJK simplex evolution, quadtree split/retrieval behavior, and the A* pathfinder including octile heuristic, vehicle footprint/slope/jump/turn-cost gates, and worker offloading. - Use Case: When adding a new clickable UI element or debugging why a vehicle path avoids a slope, consult this Skill to understand collider sync, dispatch ordering, and the vehicle pathfinding gates before modifying engine code. ## Quick Start Ask the AI to explain how click dispatch priority and consumes_click work in classic-wgl's PhysicsProvider before modifying a UI button's click handler.

Frequently Asked Questions about classic-physics

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

FAQPage Schema
How does click dispatch priority work in classic-wgl physics?

Click targets are colliders with PID >= 2 that have Click handlers and pass a GJK test against the mouse. They are sorted by click_priority descending with PID ascending as tie-break, and a handler returning true stops propagation to lower-priority targets.

How does A* pathfinding work in the classic-pathfinder crate?

find_path runs A* over a row-major nav grid using an octile heuristic and a BinaryHeap with reversed cost ordering. Searches run on a host PathfinderWorker thread or web Worker so the render thread never blocks, with request_path and poll_path as the async interface.

Does the classic-wgl pathfinder support vehicle movement?

Yes, vehicle search layers four gates on top of grid A*: footprint erosion, per-tile slope feasibility from wheel sampling, downward jump steps within safe_fall_m, and a turn_cost penalty per 45 degrees of heading change. The heuristic stays admissible because penalties only raise costs.

Why are disabled colliders not detecting collisions in classic-wgl?

begin_frame rebuilds the quadtree each frame and only inserts enabled colliders, so disabled ones are invisible to click dispatch, enter/exit, selection, and hover. Toggling enabled via set_collider_enabled takes effect on the very next frame.

What are the limitations of classic-wgl collision and pathfinding?

Enter/exit events within a single frame are missed, GJK panics after 1000 non-converging iterations, there is no multi-agent avoidance or dynamic obstacle updating, and find_path has no iteration budget so exhaustive searches on large grids can be slow.