Skip to content

box2d: polygon mode is back#2490

Merged
GarboMuffin merged 8 commits into
masterfrom
box2d-polygons
May 23, 2026
Merged

box2d: polygon mode is back#2490
GarboMuffin merged 8 commits into
masterfrom
box2d-polygons

Conversation

@GarboMuffin
Copy link
Copy Markdown
Member

@GarboMuffin GarboMuffin commented May 17, 2026

How it works: https://muffin.ink/slop/polygon.html

tl;dr scan costume pixels to generate polygon instead of relying on actual SVG path elements as the original one from griffpatch

Demonstration of the difference:

Screencast_20260516_223905.webm

@github-actions github-actions Bot added the pr: change existing extension Pull requests that change an existing extension label May 17, 2026
@GarboMuffin GarboMuffin linked an issue May 17, 2026 that may be closed by this pull request
@Brackets-Coder
Copy link
Copy Markdown
Contributor

Interesting that Claude could create a prototype. The code looks great, but of course I'd be interested in more optimized/prettier/human-like versions of this that are more cohesive with the rest of the extension

On a side note, I'd be willing to work on getting Scratch.external into this thing. As for an external kripken made an emscripten port of the original C-based Box2d https://github.com/kripken/box2d.js. Same person that ported Ammo physics. I don't know if it's in parity with the version here (probably not) but we should likely just find a way to modularize and minify the library in the extension to host it on this repo

@GarboMuffin
Copy link
Copy Markdown
Member Author

Screencast_20260517_121458.webm

@Brackets-Coder
Copy link
Copy Markdown
Contributor

Most impressive

@GarboMuffin GarboMuffin marked this pull request as ready for review May 17, 2026 23:34
@GarboMuffin GarboMuffin requested a review from a team as a code owner May 17, 2026 23:34
@GarboMuffin
Copy link
Copy Markdown
Member Author

the state of this one is that it seems to work about as good as one would expect tracing image pixels to work

@SharkPool-SP
Copy link
Copy Markdown
Collaborator

seems fine to me. I havent checked the full box2d codebase, only the given changes. Does the sillouette to polygon thing cache? If not it would be a good thing to add before merging.

Comment thread extensions/box2d.js
Comment thread extensions/box2d.js Outdated
@GarboMuffin
Copy link
Copy Markdown
Member Author

!format

@GarboMuffin GarboMuffin merged commit f2ab124 into master May 23, 2026
4 checks passed
@GarboMuffin GarboMuffin deleted the box2d-polygons branch May 23, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: change existing extension Pull requests that change an existing extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem with [Polygon] option in "Griffpatch's 2D Box Physics"

4 participants