PymunkStaticLine
The floor, the wall, the ramp — your world's fixed geometry
- space
- shape
- line
Every physics scene needs something for things to land on, and in this pack that something is a PymunkStaticLine. It adds a straight segment - a line with thickness - to your pymunk space as a static body. Static means it doesn't move and doesn't fall: no gravity, no momentum, no reaction when something bounces off it. It's the floor, the wall, the ramp, the thing your boxes and circles pile onto.
In the bundled example workflow this is the floor - a wide segment near the bottom of the frame that the dropped circles land on and roll along. If you're building any kind of scene, you'll start here.
The inputs that matter
- space - your PymunkSpace. Required.
- x1, y1 - the start point of the segment.
- x2, y2 - the end point. Defaults place a short vertical line; you'll almost always drag x2 way out to make a floor.
- radius - default
5. This is the segment's thickness for collision purposes, not a circle. A floor with radius 5 reads as a 10px-tall slab in physics terms. - elasticity - default
0.7. How bouncy collisions against this surface are. 0.7 is a decently lively bounce; drop it toward 0 for a dead, energy-absorbing floor.
The one input you should not bother with is the optional shape input. It's accepted by the node but completely ignored in the code - nothing gets merged into it. Wire it or don't; the result is identical.
How it behaves and what comes out
Under the hood the node builds a pymunk.Body with body_type=STATIC, adds a Segment shape to it, sets its elasticity, and registers both with the space. Because the body is static, the segment never moves - collisions happen against a fixed line. The output, line, is a SHAPE value, and here's the thing to understand about this pack's SHAPE type: it's really a one-element Python list of pymunk shapes. The run nodes expect that list, which is why a single shape can be wired straight in, and why merging matters once you have more than one body.
PygameRun draws segments as black lines, so a floor comes out as a thin black bar on the white background. That's also your visual sanity check: if you can't see your geometry, check the segment's coordinates against the surface dimensions, because pymunk y-coordinates map straight to pixels with y growing downward.
Installing the pack
This node ships with chaojie/ComfyUI-Pymunk. Install through ComfyUI Manager (search "ComfyUI-Pymunk") and restart, or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/chaojie/ComfyUI-Pymunk
cd ComfyUI-Pymunk && pip install -r requirements.txt
Then restart ComfyUI. The only dependencies are pymunk and pygame - no model files, nothing GPU-heavy. The pack is a small, lightly-maintained project from a single author, so if you hit a wall, the source is short enough to read.
The trap people usually walk into is forgetting static lines exist and trying to make a "floor" out of a dynamic box - which then falls through the bottom of the frame forever. Use a static line for anything that shouldn't move, and your scene will stay put.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| space | PymunkSpace | — | |
| x1 | FLOAT | 0.00 | — |
| y1 | FLOAT | 400.00 | — |
| x2 | FLOAT | 0.00 | — |
| y2 | FLOAT | 500.00 | — |
| radius | FLOAT | 5.00 | — |
| elasticity | FLOAT | 0.70 | — |
| shapeopt | SHAPE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| line | SHAPE | — |