Skip to content

Add throw origin, direction, and strength options#128

Open
djustamante wants to merge 2 commits into
3d-dice:mainfrom
djustamante:feat/throw-origin-strength
Open

Add throw origin, direction, and strength options#128
djustamante wants to merge 2 commits into
3d-dice:mainfrom
djustamante:feat/throw-origin-strength

Conversation

@djustamante

Copy link
Copy Markdown

Summary

  • New throwOrigin config — named zones (top, bottom, left, right, topLeft, topRight, bottomLeft, bottomRight, center) or explicit [x, y, z] world coords. Defaults to 'random' (unchanged behavior).
  • New throwDirection config — optional [x, y, z] vector; dice are thrown in that direction instead of toward the opposite side.
  • New throwStrength config — per-roll multiplier on throw velocity, clamped by maxThrowStrength (default 3).
  • All three are accepted both in the constructor (updateConfig) and as per-roll options in roll/add/reroll.
  • Added drag-demo/ (run with npm run demo:drag) — drag across the canvas to throw: origin = drag start, direction = drag vector, strength scales with drag length.

Test plan

  • npm install && npm run demo:drag boots the dev server
  • Tap (no drag) triggers the default random throw
  • Drag in each cardinal direction launches dice in the dragged direction from the drag origin
  • Longer drags fling harder; ceiling enforced by maxThrowStrength
  • Existing API is unchanged — bare Dice.roll('4d6') behaves as before

hearthplaygamesllc and others added 2 commits April 19, 2026 23:05
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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