Skip to content

Add Bridge & Chain span tools; fix rotated-part dimension persistence#22

Merged
SethMorrowSoftware merged 2 commits into
mainfrom
claude/determined-brown-eKqMY
Jun 5, 2026
Merged

Add Bridge & Chain span tools; fix rotated-part dimension persistence#22
SethMorrowSoftware merged 2 commits into
mainfrom
claude/determined-brown-eKqMY

Conversation

@SethMorrowSoftware
Copy link
Copy Markdown
Owner

Bridge & Chain (two-click build tools, in the demo stack's bridge style)

  • New JOINTS-section tools: click a part (or empty space) then a second point to span a chain of hinged segments. "Bridge" lays stiff planks that sag under load; "Chain" drapes a rope of small light links.
  • Segments are normal parts and links are exact-pivot "pin" hinges (a new internal joint kind, no marker), so a span renders, saves, loads and deletes like anything else. The existing rigid "Rope" joint is unchanged.
  • Tightened the palette button metrics so the two extra tools fit.

Rotated-part dimension persistence (fixes a latent bug)

  • Dynamic boxes render as rotated polygons, so a rotated box's the width/height becomes its inflated bounding box; partLine saved that, so rotated parts (the Angle control, and angled span segments) reloaded at the wrong size. Each part now records its design size in uW/uH at creation, and save/resize/labels use those. Axis-aligned parts are unaffected (uW/uH == the width/height), so existing saves stay identical. setPartDimension resizes in an upright frame so rotated parts scale right.

https://claude.ai/code/session_01AyoQTVuyLtPMrR5oVW6FFr

Bridge & Chain (two-click build tools, in the demo stack's bridge style)
- New JOINTS-section tools: click a part (or empty space) then a second
  point to span a chain of hinged segments. "Bridge" lays stiff planks
  that sag under load; "Chain" drapes a rope of small light links.
- Segments are normal parts and links are exact-pivot "pin" hinges (a new
  internal joint kind, no marker), so a span renders, saves, loads and
  deletes like anything else. The existing rigid "Rope" joint is unchanged.
- Tightened the palette button metrics so the two extra tools fit.

Rotated-part dimension persistence (fixes a latent bug)
- Dynamic boxes render as rotated polygons, so a rotated box's
  the width/height becomes its inflated bounding box; partLine saved that,
  so rotated parts (the Angle control, and angled span segments) reloaded
  at the wrong size. Each part now records its design size in uW/uH at
  creation, and save/resize/labels use those. Axis-aligned parts are
  unaffected (uW/uH == the width/height), so existing saves stay identical.
  setPartDimension resizes in an upright frame so rotated parts scale right.

https://claude.ai/code/session_01AyoQTVuyLtPMrR5oVW6FFr
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a5c8fac037

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +2303 to +2304
if tHit is empty and gJointTool is not "hinge" and gJointTool is not "bridge" and gJointTool is not "chain" then
put "Part B must be a part for a " & gJointTool & " joint (Hinge, Bridge and Chain can pin to the world)." into gStatus
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow spans to start from empty space

Bridge and Chain only permit an empty-space world anchor on the second click. The first-click branch at lines 2286-2292 still rejects an empty hit and uses gPendCtrl is empty to mean that no endpoint is pending, so users cannot perform the documented “empty space, then second point” flow or anchor the start of a span to the world. Add separate pending-state tracking and support a world-backed first endpoint.

Useful? React with 👍 / 👎.

Additions (mirrored in the standalone Kit and the demo's embedded copy,
unit-consistent with the existing px/deg wrappers):
- b2kImpulse ctrl, ix, iy        one-shot mass-aware kick (b2ApplyImpulse)
- b2kTorque ctrl, torque         continuous turning force (b2ApplyTorque)
- b2kSleep ctrl                  send a body to sleep (pairs with b2kWake)
- b2kSetSleepThreshold ctrl, pxPerSec
- b2kSpinRate(ctrl)              angular-velocity getter, deg/s (pairs with b2kSpin)
- b2kIsBullet(ctrl) / b2kIsEnabled(ctrl)   state getters
- b2kRopeSetLength joint, px     set a distance joint's exact rest length

Robustness:
- b2kSetBounce / b2kSetFriction / b2kSetDensity now no-op when the control
  has no shape yet, instead of passing an empty handle to the core (avoids
  errors when called on a bodiless or not-yet-shaped control).

Documented in docs/kit-reference.md. All additive; no existing behaviour changed.

https://claude.ai/code/session_01AyoQTVuyLtPMrR5oVW6FFr
@SethMorrowSoftware SethMorrowSoftware merged commit 6c59b96 into main Jun 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants