fix(tabletop): tilt cards uniformly about the y axis

Apply the same tilt to every stacked part and rotate it about its local
Y axis instead of Z. Default tilt to 1 degree when a stacking strategy
is present, and arc the poker deck along the surface's bottom edge.
This commit is contained in:
2026-08-10 00:23:08 +08:00
parent b312bf4f1f
commit 43c6334413
7 changed files with 23 additions and 23 deletions
+2 -2
View File
@@ -21,7 +21,7 @@ export function PartPlacement({ pkg, placement }: { pkg: Package; placement: Pla
// Route anchors and stacking offsets are in mm; convert to world units so
// parts land on the (world-scaled) surface. `z` raises the part along the
// surface normal (world +Y); `tilt` fans it about its local Y (long) axis.
// surface normal (world +Y); `tilt` rotates it about its local Y (long) axis.
// Angles are authored in degrees; three.js expects radians.
const anchorX = ((candidate?.x ?? route.x ?? 0) + x) * MM_TO_WORLD;
const anchorY = ((candidate?.y ?? route.y ?? 0) + y) * MM_TO_WORLD;
@@ -31,7 +31,7 @@ export function PartPlacement({ pkg, placement }: { pkg: Package; placement: Pla
return (
<group position={[anchorX, anchorZ, anchorY]} rotation={[0, anchorRotation, 0]}>
{/* The part mesh extrudes along +Z; lay it flat so its face points up. */}
<group rotation={[-Math.PI / 2, 0, tilt * DEG_TO_RAD]}>
<group rotation={[-Math.PI / 2, tilt * DEG_TO_RAD, 0]}>
<PartView part={part} baseUrl={part.baseUrl} />
</group>
</group>