Spaces:
Sleeping
Sleeping
add left right
Browse files
src/components/cube-piece.tsx
CHANGED
|
@@ -25,8 +25,8 @@ export const CubePiece = ({ roughness, initialPosition }: CubePieceProps) => {
|
|
| 25 |
const visibleFaces = {
|
| 26 |
front: z > 0,
|
| 27 |
back: z < 0,
|
| 28 |
-
right: x > 0,
|
| 29 |
left: x < 0,
|
|
|
|
| 30 |
top: y > 0,
|
| 31 |
bottom: y < 0,
|
| 32 |
};
|
|
@@ -57,14 +57,14 @@ export const CubePiece = ({ roughness, initialPosition }: CubePieceProps) => {
|
|
| 57 |
stickerPosition = [0, 0, -0.48];
|
| 58 |
stickerRotation = [0, Math.PI, 0];
|
| 59 |
break;
|
| 60 |
-
case "right":
|
| 61 |
-
stickerPosition = [0.48, 0, 0];
|
| 62 |
-
stickerRotation = [0, Math.PI / 2, 0];
|
| 63 |
-
break;
|
| 64 |
case "left":
|
| 65 |
stickerPosition = [-0.48, 0, 0];
|
| 66 |
stickerRotation = [0, -Math.PI / 2, 0];
|
| 67 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
case "top":
|
| 69 |
stickerPosition = [0, 0.48, 0];
|
| 70 |
stickerRotation = [-Math.PI / 2, 0, 0];
|
|
|
|
| 25 |
const visibleFaces = {
|
| 26 |
front: z > 0,
|
| 27 |
back: z < 0,
|
|
|
|
| 28 |
left: x < 0,
|
| 29 |
+
right: x > 0,
|
| 30 |
top: y > 0,
|
| 31 |
bottom: y < 0,
|
| 32 |
};
|
|
|
|
| 57 |
stickerPosition = [0, 0, -0.48];
|
| 58 |
stickerRotation = [0, Math.PI, 0];
|
| 59 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
case "left":
|
| 61 |
stickerPosition = [-0.48, 0, 0];
|
| 62 |
stickerRotation = [0, -Math.PI / 2, 0];
|
| 63 |
break;
|
| 64 |
+
case "right":
|
| 65 |
+
stickerPosition = [0.48, 0, 0];
|
| 66 |
+
stickerRotation = [0, Math.PI / 2, 0];
|
| 67 |
+
break;
|
| 68 |
case "top":
|
| 69 |
stickerPosition = [0, 0.48, 0];
|
| 70 |
stickerRotation = [-Math.PI / 2, 0, 0];
|
src/components/rotation-panel.tsx
CHANGED
|
@@ -14,11 +14,13 @@ export const RotationPanel = ({ direction, face }: RotationPanelProps) => {
|
|
| 14 |
const position: Record<string, [number, number, number]> = {
|
| 15 |
front: clockwise ? [0.5, 0, 1.01] : [-0.5, 0, 1.01],
|
| 16 |
back: clockwise ? [-0.5, 0, -1.01] : [0.5, 0, -1.01],
|
|
|
|
| 17 |
right: clockwise ? [1.01, 0, -0.5] : [1.01, 0, 0.5],
|
| 18 |
};
|
| 19 |
const rotation: Record<string, [number, number, number]> = {
|
| 20 |
front: [0, 0, 0],
|
| 21 |
back: [0, Math.PI, 0],
|
|
|
|
| 22 |
right: [0, Math.PI / 2, 0],
|
| 23 |
};
|
| 24 |
return (
|
|
|
|
| 14 |
const position: Record<string, [number, number, number]> = {
|
| 15 |
front: clockwise ? [0.5, 0, 1.01] : [-0.5, 0, 1.01],
|
| 16 |
back: clockwise ? [-0.5, 0, -1.01] : [0.5, 0, -1.01],
|
| 17 |
+
left: clockwise ? [-1.01, 0, 0.5] : [-1.01, 0, -0.5],
|
| 18 |
right: clockwise ? [1.01, 0, -0.5] : [1.01, 0, 0.5],
|
| 19 |
};
|
| 20 |
const rotation: Record<string, [number, number, number]> = {
|
| 21 |
front: [0, 0, 0],
|
| 22 |
back: [0, Math.PI, 0],
|
| 23 |
+
left: [0, -Math.PI / 2, 0],
|
| 24 |
right: [0, Math.PI / 2, 0],
|
| 25 |
};
|
| 26 |
return (
|
src/components/rubiks-cube.tsx
CHANGED
|
@@ -28,6 +28,8 @@ export const RubiksCube = ({ roughness }: RubiksCubeProps) => {
|
|
| 28 |
<RotationPanel direction="counter-clockwise" face="front" />
|
| 29 |
<RotationPanel direction="clockwise" face="back" />
|
| 30 |
<RotationPanel direction="counter-clockwise" face="back" />
|
|
|
|
|
|
|
| 31 |
<RotationPanel direction="clockwise" face="right" />
|
| 32 |
<RotationPanel direction="counter-clockwise" face="right" />
|
| 33 |
</group>
|
|
|
|
| 28 |
<RotationPanel direction="counter-clockwise" face="front" />
|
| 29 |
<RotationPanel direction="clockwise" face="back" />
|
| 30 |
<RotationPanel direction="counter-clockwise" face="back" />
|
| 31 |
+
<RotationPanel direction="clockwise" face="left" />
|
| 32 |
+
<RotationPanel direction="counter-clockwise" face="left" />
|
| 33 |
<RotationPanel direction="clockwise" face="right" />
|
| 34 |
<RotationPanel direction="counter-clockwise" face="right" />
|
| 35 |
</group>
|