Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

Walk the club entrance as your own avatar; fix /irl Camera AR button

nirholas6b249acc1ee9
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f1210ffa5..022c3c15e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Avatars come to life — animations now play on the avatar page** — Every avatar page now plays its built-in animation the moment it loads, so a rigged avatar stands, breathes, or performs its motion instead of freezing in a static pose. A new floating control sits over the 3D stage: a play/pause button, plus a clip switcher when an avatar carries more than one take so you can jump between them. Avatars with no embedded motion are unaffected — the control only appears when there's something to play. `[feature]`
- **Browse every community avatar from your dashboard** — The dashboard Avatars page now has a Community tab alongside My avatars. It shows every public 3D avatar the whole community has built — with live spinning previews, a running count and total views, search, tag filters, and infinite scroll. Open any one as a live page, remix it in the 3D studio, or copy its share link, embed snippet, or GLB URL in a click. (`/dashboard/avatars`) `[feature]`
- **Buy and sell USDC-paired coins straight from the trade widget** — The in-world trade widget now speaks both currencies. Open Buy on a coin and the widget reads its real pairing from the chain: a SOL coin asks for SOL exactly as before, while a USDC-paired coin denominates the amount in USDC, shows your wallet's USDC balance, and prices and settles the trade in USDC. A new Sell tab lets you sell a coin you hold back to its quote asset — pick 25%, 50%, or Max of your balance, see the live payout, and sign once; for USDC coins the payout account is opened for you automatically in the same transaction. Every state is handled: not enough USDC offers a one-tap Add-funds flow, a moved price explains your slippage, and a cancelled signature is quietly acknowledged. The whole flow is your own wallet, signed in your browser, with a Solscan link the moment it lands. (`/play`) `[feature]`
+- **Camera AR on /irl now turns on** — The "Camera AR" button on the IRL page was stuck — it never lit up, on desktop or phone, so you could never drop your avatar into your real room. A startup error in the joystick setup was crashing the page's script before the button could ever be enabled. Fixed: the button now activates once your avatar loads, and tapping it opens the camera so you can walk your avatar across your real floor. (`/irl`) `[fix]`
- **Chat never stalls on a down AI model — instant, quiet failover** — If you pick a specific AI model for the agent (say Claude) and our key for that provider is temporarily unavailable, chat now hands you an answer instantly from a healthy free model instead of pausing on the dead provider. Previously the app re-tried the unavailable provider on the very first attempt of every single message — adding a little delay each time and filling our logs with repeat warnings. Now a provider with a key or billing problem is set aside for a few minutes after the first failure and skipped up front, even when it was the one you explicitly chose, so the next message goes straight to a model that works. Free-first, always a working fallback. (`/chat`) `[improvement]`
- **Clearer launch & trade errors, and a graduated badge on coins** — When a token launch or an in-world trade can't go through, the app now tells you exactly why and what to do next — "Not enough SOL to cover the launch + network fees," "Price moved beyond your slippage limit," "You cancelled the signature in your wallet," or "Couldn't reach the Solana network" — instead of a single catch-all "Connection error." Coins also show their lifecycle at a glance: the trade panel carries a badge marking whether a coin is still on its bonding curve or has graduated to the PumpSwap AMM, so a graduated coin is unmistakable. Backed by new end-to-end browser tests that drive the full four-step launch flow and the buy/sell widget so this conversion path can't silently break. (`/pump-dashboard`) `[improvement]`
- **Homepage Forge is more reliable — no more "busy" on the second model** — The mini Forge on the homepage now runs on the same free Standard lane as the full /forge page. Before, it used the free draft preview, which has tight concurrency and would return a "generator is busy" message on a quick second generation. Now back-to-back prompts hold up — models still land free with no sign-up, and the platform automatically degrades to the faster free lane if the main one is throttled. (`/forge`) `[fix]`
@@ -42,7 +43,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **three.ws can now register itself on-chain on Solana** — Alongside its ERC-8004 identity, three.ws can now mint its own agent on Solana — as a Metaplex Core asset in the official "three.ws Agents" collection, exactly the way agents you deploy through the platform are registered. A one-command tool builds the platform's 3D Agent Card, verifies the avatar's SHA-256 against the exact GLB bytes served (so the model can't be silently swapped), pins the metadata, mints the asset into the collection, and writes the result back into the public discovery documents at three.ws/.well-known so any wallet, explorer, or agent can resolve and verify three.ws. The discovery card and its schema now carry Solana identities (CAIP-10) alongside EVM ones, and the platform agent's on-chain badge links straight to its Solana passport. (`/.well-known/agent-registration.json`) `[feature, infra]`
- **three.ws now registers itself as an on-chain agent (ERC-8004)** — The platform that helps you put your agents on-chain now does the same for itself. three.ws publishes a 3D Agent Card — a verifiable manifest of its name, its default 3D avatar, and its A2A/MCP/x402 service endpoints — at three.ws/.well-known/3d-agent-card.json, and ships a one-command tool that mints the platform agent in the canonical ERC-8004 IdentityRegistry on Base (with a Base Sepolia rehearsal first). The card cryptographically commits to the avatar: the SHA-256 in the card matches the exact GLB bytes served, so any indexer or wallet can independently verify the model hasn't been swapped. Other agents and directories can now discover and trust three.ws the same way three.ws lets them be discovered. `[feature, infra]`
- **USDC-paired agent coins now record and display correct trade amounts** — Coins launched against USDC are now tracked in the right currency end to end. Every buy and sell records which quote asset it actually used and how much of it moved — USDC amounts in USDC, SOL amounts in SOL — instead of quietly storing a USDC trade as if it were SOL and reporting a price and market cap that were off by orders of magnitude. Portfolios now subtotal holdings separately by quote asset, so your SOL positions and USDC positions each get their own value, cost basis, and unrealized P&L with no more mixing of mismatched units. Existing SOL trades are unchanged, and historical rows were backfilled as SOL-paired so nothing shifts. `[fix, feature]`
-- **Walk into the Pole Club — a 3D entrance, not a loading screen** — The club now has a way in. Land on /club and you're standing in an alley outside, in line at the door. Pay the $0.01 cover and the rope drops — you walk first-person through the club house interior, the night's anthem kicks in the moment you step inside, and the room with the poles opens up around you. The whole journey is real 3D, streamed from compressed scenes (~20 MB exports cut to ~1.6 MB each) so it loads while you wait at the door. Already paid tonight? You skip the line and walk straight back in. (`/club`) `[feature]`
+- **Walk into the Pole Club as your own 3D avatar** — The club now has a way in that you control. Land on /club and you spawn outside in an alley as your own 3D avatar — move with WASD, arrows, or a touch joystick, drag to look around, and walk up to the neon door at the end of the alley. Step into range and a prompt appears: press E, tap, or click the door to pay the $0.01 cover. Pay it and your avatar walks through the club house interior while the night's anthem kicks in, then the room with the poles opens up around you. It's all real 3D, streamed from compressed scenes (~20 MB exports cut to ~1.6 MB each) and prefetched while you walk so nothing stalls. Already paid tonight? You skip the line and walk straight in. (`/club`) `[feature]`
## 2026-06-14
diff --git a/data/changelog.json b/data/changelog.json
index 2a9b99cda..d60df6705 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -3,8 +3,15 @@
"entries": [
{
"date": "2026-06-15",
- "title": "Walk into the Pole Club — a 3D entrance, not a loading screen",
- "summary": "The club now has a way in. Land on /club and you're standing in an alley outside, in line at the door. Pay the $0.01 cover and the rope drops — you walk first-person through the club house interior, the night's anthem kicks in the moment you step inside, and the room with the poles opens up around you. The whole journey is real 3D, streamed from compressed scenes (~20 MB exports cut to ~1.6 MB each) so it loads while you wait at the door. Already paid tonight? You skip the line and walk straight back in.",
+ "title": "Camera AR on /irl now turns on",
+ "summary": "The \"Camera AR\" button on the IRL page was stuck — it never lit up, on desktop or phone, so you could never drop your avatar into your real room. A startup error in the joystick setup was crashing the page's script before the button could ever be enabled. Fixed: the button now activates once your avatar loads, and tapping it opens the camera so you can walk your avatar across your real floor.",
+ "tags": ["fix"],
+ "link": "/irl"
+ },
+ {
+ "date": "2026-06-15",
+ "title": "Walk into the Pole Club as your own 3D avatar",
+ "summary": "The club now has a way in that you control. Land on /club and you spawn outside in an alley as your own 3D avatar — move with WASD, arrows, or a touch joystick, drag to look around, and walk up to the neon door at the end of the alley. Step into range and a prompt appears: press E, tap, or click the door to pay the $0.01 cover. Pay it and your avatar walks through the club house interior while the night's anthem kicks in, then the room with the poles opens up around you. It's all real 3D, streamed from compressed scenes (~20 MB exports cut to ~1.6 MB each) and prefetched while you walk so nothing stalls. Already paid tonight? You skip the line and walk straight in.",
"tags": ["feature"],
"link": "/club"
},
diff --git a/pages/club.html b/pages/club.html
index 270df1e89..df398f2db 100644
--- a/pages/club.html
+++ b/pages/club.html
@@ -602,11 +602,12 @@
100% { opacity: 0; visibility: hidden; }
}
- /* ── Entrance journey canvas ────────────────────────── */
- /* The live first-person scene (src/club-entrance.js): the alley you
- land in, then the walk through the club house. Full-screen, behind
- the door card, above the pole stage. pointer-events:none so the
- card owns interaction; the module fades + removes it on arrival. */
+ /* ── Entrance scene canvas ──────────────────────────── */
+ /* The live third-person scene (src/club-entrance.js): your avatar in
+ the alley, then the walk through the club house. Full-screen, below
+ the cover card, above the pole stage. Takes pointer input for the
+ move/look controller; touch-action:none so drags don't scroll the
+ page. The module fades + removes it on arrival at the stage. */
.club-door-canvas {
position: fixed;
inset: 0;
@@ -614,9 +615,133 @@
height: 100%;
display: block;
z-index: 9400;
+ touch-action: none;
+ cursor: grab;
+ }
+ .club-door-canvas:active { cursor: grabbing; }
+
+ /* ── Entrance controller UI ─────────────────────────── */
+ /* Sit above the scene canvas (9400), below the cover card (9500). */
+ .club-controls-hint {
+ position: fixed;
+ left: 50%;
+ bottom: 28px;
+ transform: translateX(-50%) translateY(8px);
+ z-index: 9440;
+ padding: 9px 16px;
+ border-radius: 999px;
+ background: rgba(8, 5, 12, 0.62);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ backdrop-filter: blur(8px);
+ color: var(--text-2, #c9c2d6);
+ font-size: 13px;
+ letter-spacing: 0.01em;
+ pointer-events: none;
+ opacity: 0;
+ transition: opacity 0.5s ease, transform 0.5s ease;
+ }
+ .club-controls-hint.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
+
+ .club-door-prompt {
+ position: fixed;
+ left: 50%;
+ top: 50%;
+ transform: translate(-50%, -50%) scale(0.92);
+ z-index: 9460;
+ display: inline-flex;
+ align-items: center;
+ gap: 10px;
+ padding: 13px 22px;
+ border-radius: 14px;
+ border: 1px solid rgba(255, 59, 214, 0.55);
+ background: rgba(14, 6, 18, 0.82);
+ box-shadow: 0 0 34px -6px rgba(255, 59, 214, 0.7);
+ color: #fff;
+ font-size: 16px;
+ font-weight: 600;
+ cursor: pointer;
+ pointer-events: none;
+ opacity: 0;
+ transition: opacity 0.25s ease, transform 0.25s ease;
+ }
+ .club-door-prompt.is-visible {
+ opacity: 1;
+ pointer-events: auto;
+ transform: translate(-50%, -50%) scale(1);
+ animation: clubPromptBob 1.8s ease-in-out infinite;
+ }
+ .club-door-prompt:hover { border-color: #ff3bd6; box-shadow: 0 0 44px -4px rgba(255, 59, 214, 0.9); }
+ .club-door-prompt:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
+ .club-door-prompt kbd {
+ font: 600 12px/1 'Inter', system-ui, sans-serif;
+ padding: 3px 8px;
+ border-radius: 6px;
+ background: rgba(255, 255, 255, 0.12);
+ border: 1px solid rgba(255, 255, 255, 0.25);
+ box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset;
+ }
+ @keyframes clubPromptBob {
+ 0%, 100% { transform: translate(-50%, -50%) scale(1); }
+ 50% { transform: translate(-50%, calc(-50% - 5px)) scale(1); }
+ }
+
+ /* Touch joystick — repositions to first touch on the left of screen. */
+ .club-joystick {
+ position: fixed;
+ width: 124px;
+ height: 124px;
+ margin: -62px 0 0 -62px; /* centre on its left/top anchor */
+ border-radius: 50%;
+ background: radial-gradient(circle, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02) 70%, transparent);
+ border: 1px solid rgba(255, 255, 255, 0.14);
+ z-index: 9450;
pointer-events: none;
+ display: none;
+ opacity: 0;
+ transition: opacity 0.3s ease;
+ left: -200px;
+ top: -200px;
+ }
+ .club-joystick.is-visible { display: block; }
+ .club-joystick.is-active { opacity: 1; }
+ .club-joystick-knob {
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ width: 52px;
+ height: 52px;
+ margin: -26px 0 0 -26px;
+ border-radius: 50%;
+ background: rgba(255, 59, 214, 0.5);
+ border: 1px solid rgba(255, 255, 255, 0.4);
+ box-shadow: 0 0 18px -2px rgba(255, 59, 214, 0.8);
+ }
+ @media (prefers-reduced-motion: reduce) {
+ .club-door-prompt.is-visible { animation: none; }
}
+ /* The cover card stays hidden until you reach the door in the alley. */
+ .club-door[data-state='hidden'] {
+ opacity: 0;
+ visibility: hidden;
+ pointer-events: none;
+ }
+ .club-door-back {
+ margin-top: 14px;
+ background: none;
+ border: 0;
+ color: var(--text-2, #c9c2d6);
+ font-size: 13px;
+ cursor: pointer;
+ padding: 6px 10px;
+ border-radius: 8px;
+ transition: color 0.15s ease, background 0.15s ease;
+ }
+ .club-door-back:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
+ .club-door-back:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
+ /* Only offer the way back out while you're deciding (queue state). */
+ .club-door:not([data-state='queue']) .club-door-back { display: none; }
+
/* ── Door / cover-charge gate ───────────────────────── */
/* The line outside the club, in the alley. Sits above the entrance
scene (which renders behind it) but below the x402 wallet modal
@@ -1282,11 +1407,20 @@
<!-- Entrance overlay — fades out over 1s on load -->
<div id="club-entrance" class="club-entrance" aria-hidden="true"></div>
- <!-- Entrance journey — live first-person scene (src/club-entrance.js):
- the alley you land in, then the walk through the club house after
- you pay. Sits behind the door card, above the pole stage. -->
+ <!-- Entrance scene — live third-person scene (src/club-entrance.js): your
+ avatar in the alley, then the walk through the club house after you
+ pay. Sits behind the cover card, above the pole stage. -->
<canvas id="club-door-canvas" class="club-door-canvas" aria-hidden="true"></canvas>
+ <!-- Controller UI for the alley (toggled by src/club-entrance.js). -->
+ <div id="club-controls-hint" class="club-controls-hint" role="status" aria-live="polite"></div>
+ <button id="club-door-prompt" type="button" class="club-door-prompt" aria-label="Enter the club">
+ Enter the club <kbd>E</kbd>
+ </button>
+ <div id="club-joystick" class="club-joystick" aria-hidden="true">
+ <div id="club-joystick-knob" class="club-joystick-knob"></div>
+ </div>
+
<!-- Door / cover-charge gate — the line outside the club, in the alley.
The 3D room boots behind this overlay; src/club-gate.js drops the
rope once the x402 cover settles and the on-chain bouncer admits
@@ -1294,7 +1428,7 @@
<div
id="club-door"
class="club-door"
- data-state="queue"
+ data-state="hidden"
role="dialog"
aria-modal="true"
aria-labelledby="club-door-title"
@@ -1308,12 +1442,12 @@
<!-- QUEUE: pay the cover -->
<div class="club-door-state is-queue">
- <p class="club-door-eyebrow">You're in line · out in the alley</p>
+ <p class="club-door-eyebrow">At the door</p>
<h1 id="club-door-title" class="club-door-title">Pole Club</h1>
<p class="club-door-copy">
- There's a cover tonight. Pay <b>$0.01 USDC</b> at the door — the
- bouncer checks your wallet on-chain, and if you're on the list, the
- rope drops and you walk inside.
+ There's a cover tonight. Pay <b>$0.01 USDC</b> — the bouncer checks
+ your wallet on-chain, and if you're on the list, the rope drops and
+ you walk inside.
</p>
<button type="button" id="club-door-pay" class="club-door-pay">
Pay cover · $0.01 to enter
@@ -1323,6 +1457,7 @@
Settled on-chain via <b>x402</b> on Base or Solana. One cover gets
you in for the night.
</p>
+ <button type="button" id="club-door-back" class="club-door-back">← Back to the alley</button>
</div>
<!-- CHECKING: bouncer reads the list -->
diff --git a/public/changelog.json b/public/changelog.json
index d71eb241f..d53e26bfc 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-15T17:27:04.306Z",
+ "generated_at": "2026-06-15T19:05:35.826Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -98,6 +98,16 @@
"feature"
]
},
+ {
+ "date": "2026-06-15",
+ "type": "update",
+ "title": "Camera AR on /irl now turns on",
+ "summary": "The \"Camera AR\" button on the IRL page was stuck — it never lit up, on desktop or phone, so you could never drop your avatar into your real room. A startup error in the joystick setup was crashing the page's script before the button could ever be enabled. Fixed: the button now activates once your avatar loads, and tapping it opens the camera so you can walk your avatar across your real floor.",
+ "link": "/irl",
+ "tags": [
+ "fix"
+ ]
+ },
{
"date": "2026-06-15",
"type": "update",
@@ -381,8 +391,8 @@
{
"date": "2026-06-15",
"type": "update",
- "title": "Walk into the Pole Club — a 3D entrance, not a loading screen",
- "summary": "The club now has a way in. Land on /club and you're standing in an alley outside, in line at the door. Pay the $0.01 cover and the rope drops — you walk first-person through the club house interior, the night's anthem kicks in the moment you step inside, and the room with the poles opens up around you. The whole journey is real 3D, streamed from compressed scenes (~20 MB exports cut to ~1.6 MB each) so it loads while you wait at the door. Already paid tonight? You skip the line and walk straight back in.",
+ "title": "Walk into the Pole Club as your own 3D avatar",
+ "summary": "The club now has a way in that you control. Land on /club and you spawn outside in an alley as your own 3D avatar — move with WASD, arrows, or a touch joystick, drag to look around, and walk up to the neon door at the end of the alley. Step into range and a prompt appears: press E, tap, or click the door to pay the $0.01 cover. Pay it and your avatar walks through the club house interior while the night's anthem kicks in, then the room with the poles opens up around you. It's all real 3D, streamed from compressed scenes (~20 MB exports cut to ~1.6 MB each) and prefetched while you walk so nothing stalls. Already paid tonight? You skip the line and walk straight in.",
"link": "/club",
"tags": [
"feature"
diff --git a/public/changelog.xml b/public/changelog.xml
index 401ccdc76..4b1a329f1 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -78,6 +78,14 @@
<category>feature</category>
<description>The in-world trade widget now speaks both currencies. Open Buy on a coin and the widget reads its real pairing from the chain: a SOL coin asks for SOL exactly as before, while a USDC-paired coin denominates the amount in USDC, shows your wallet's USDC balance, and prices and settles the trade in USDC. A new Sell tab lets you sell a coin you hold back to its quote asset — pick 25%, 50%, or Max of your balance, see the live payout, and sign once; for USDC coins the payout account is opened for you automatically in the same transaction. Every state is handled: not enough USDC offers a one-tap Add-funds flow, a moved price explains your slippage, and a cancelled signature is quietly acknowledged. The whole flow is your own wallet, signed in your browser, with a Solscan link the moment it lands.</description>
</item>
+ <item>
+ <title>Camera AR on /irl now turns on</title>
+ <link>https://three.ws/irl</link>
+ <guid isPermaLink="false">2026-06-15:Camera AR on /irl now turns on</guid>
+ <pubDate>Mon, 15 Jun 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>The &quot;Camera AR&quot; button on the IRL page was stuck — it never lit up, on desktop or phone, so you could never drop your avatar into your real room. A startup error in the joystick setup was crashing the page's script before the button could ever be enabled. Fixed: the button now activates once your avatar loads, and tapping it opens the camera so you can walk your avatar across your real floor.</description>
+ </item>
<item>
<title>Chat never stalls on a down AI model — instant, quiet failover</title>
<link>https://three.ws/chat</link>
@@ -295,12 +303,12 @@
<description>Coins launched against USDC are now tracked in the right currency end to end. Every buy and sell records which quote asset it actually used and how much of it moved — USDC amounts in USDC, SOL amounts in SOL — instead of quietly storing a USDC trade as if it were SOL and reporting a price and market cap that were off by orders of magnitude. Portfolios now subtotal holdings separately by quote asset, so your SOL positions and USDC positions each get their own value, cost basis, and unrealized P&amp;L with no more mixing of mismatched units. Existing SOL trades are unchanged, and historical rows were backfilled as SOL-paired so nothing shifts.</description>
</item>
<item>
- <title>Walk into the Pole Club — a 3D entrance, not a loading screen</title>
+ <title>Walk into the Pole Club as your own 3D avatar</title>
<link>https://three.ws/club</link>
- <guid isPermaLink="false">2026-06-15:Walk into the Pole Club — a 3D entrance, not a loading screen</guid>
+ <guid isPermaLink="false">2026-06-15:Walk into the Pole Club as your own 3D avatar</guid>
<pubDate>Mon, 15 Jun 2026 12:00:00 GMT</pubDate>
<category>feature</category>
- <description>The club now has a way in. Land on /club and you're standing in an alley outside, in line at the door. Pay the $0.01 cover and the rope drops — you walk first-person through the club house interior, the night's anthem kicks in the moment you step inside, and the room with the poles opens up around you. The whole journey is real 3D, streamed from compressed scenes (~20 MB exports cut to ~1.6 MB each) so it loads while you wait at the door. Already paid tonight? You skip the line and walk straight back in.</description>
+ <description>The club now has a way in that you control. Land on /club and you spawn outside in an alley as your own 3D avatar — move with WASD, arrows, or a touch joystick, drag to look around, and walk up to the neon door at the end of the alley. Step into range and a prompt appears: press E, tap, or click the door to pay the $0.01 cover. Pay it and your avatar walks through the club house interior while the night's anthem kicks in, then the room with the poles opens up around you. It's all real 3D, streamed from compressed scenes (~20 MB exports cut to ~1.6 MB each) and prefetched while you walk so nothing stalls. Already paid tonight? You skip the line and walk straight in.</description>
</item>
<item>
<title>Building 3D AI Agents Live</title>
diff --git a/public/features.json b/public/features.json
index 06327db2e..37ef7eb05 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-15T17:27:04.288Z",
+ "generated_at": "2026-06-15T19:05:35.815Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/src/club-entrance.js b/src/club-entrance.js
index 52256cbfe..08e9d8cf0 100644
--- a/src/club-entrance.js
+++ b/src/club-entrance.js
@@ -1,62 +1,75 @@
-// /club entrance — a first-person spatial journey into the club.
+// /club entrance — walk up to the club as your own 3D avatar.
//
-// You don't drop straight onto the pole floor. You arrive in the alley
-// outside, pay the cover at the door, then walk through the Space Smugglers
-// club house before the room with the poles opens up. Three beats, rendered
-// into one full-screen canvas (#club-door-canvas) layered under the cover
-// door card and above the pole stage (src/club.js, which boots in parallel):
+// You don't drop onto the pole floor. You spawn outside in the alley as a
+// third-person avatar and you're in control: move (WASD / arrows / touch
+// joystick), look around (drag), and walk up to the neon door at the end of
+// the alley. Step into range and a prompt appears — press E, tap, or click the
+// door — and only then does the cover-charge card (src/club-gate.js) ask you
+// to pay. Pay the cover and your avatar walks through the Space Smugglers club
+// house interior while the anthem plays (wired in src/club.js), and the room
+// with the poles opens up around you (src/club.js, booting behind it all).
//
-// 1. ALLEY — you stand in alleyway.glb. The cover door (src/club-gate.js)
-// floats over the scene as the line outside.
-// 2. WALK-THROUGH — on `club:admitted` the canvas dips, swaps to the club
-// house interior, and the camera walks forward through it
-// while the walk-in anthem plays (wired in src/club.js).
-// 3. ARRIVE — the canvas fades out and disposes, revealing the pole
-// stage that has been warming behind it the whole time.
-//
-// Deliberately light: two ~1.6 MB Meshopt+WebP environments (built by
-// scripts/build-club-entrance-venue.mjs), a moody light rig, no avatar rig
-// and no postprocessing. The club house is prefetched during the queue so the
-// walk-through never stalls. If a wallet already holds a pass for the night,
-// the door is gone on load and we skip the journey entirely. Any scene failure
-// degrades silently — the cover door and the room behind it still work.
+// Everything renders into one full-screen canvas (#club-door-canvas) layered
+// above the pole stage and below the cover card. Two ~1.6 MB Meshopt+WebP
+// environments (built by scripts/build-club-entrance-venue.mjs) plus the
+// shared avatar GLB; the interior is prefetched while you walk so the
+// transition never stalls. Already paid tonight? The door is gone on load and
+// we skip the whole thing. Any load failure degrades silently — the cover card
+// and the room behind it still work.
import {
AmbientLight,
Box3,
+ BoxGeometry,
Fog,
Group,
HemisphereLight,
+ Mesh,
+ MeshStandardMaterial,
PerspectiveCamera,
PointLight,
+ Raycaster,
Scene,
SpotLight,
SRGBColorSpace,
+ Vector2,
Vector3,
WebGLRenderer,
ACESFilmicToneMapping,
} from 'three';
import { gltfLoader } from './loaders/gltf.js';
+import { AnimationManager } from './animation-manager.js';
import { log } from './shared/log.js';
const ALLEYWAY_URL = '/club/venue/alleyway.glb';
const CLUBHOUSE_URL = '/club/venue/space-smugglers-clubhouse.glb';
+const AVATAR_URL = '/avatars/default.glb';
+const MANIFEST_URL = '/animations/manifest.json';
const PASS_KEY = 'club:pass:v1';
+const MOVE_CLIPS = new Set(['idle', 'walk']);
-const EYE = 1.62; // camera eye height, metres
-const ROOM_HEIGHT = 7.0; // environments are normalised to this Y so eye height reads human
+const ROOM_HEIGHT = 7.0; // environments normalised to this Y so the avatar reads human
+const AVATAR_HEIGHT = 1.75;
+const MOVE_SPEED = 2.6; // metres / second
+const DOOR_RANGE = 2.6; // how close you stand before the prompt shows
+const CAM_DIST = 3.6;
+const CAM_HEIGHT = 1.55;
+const HEAD_Y = 1.2;
-// Walk-through timeline (seconds).
-const LEAVE = 0.7; // fade the alley out as you step through the door
-const ENTER = 0.7; // fade the club house interior in
-const WALK = 4.2; // camera dolly forward through the interior
+// Walk-through timeline (seconds), once the cover settles.
+const LEAVE = 1.3; // walk forward through the alley door
+const ENTER = 0.6; // fade the interior in
+const WALK = 4.4; // walk forward through the interior
const ARRIVE = 0.9; // fade out, revealing the pole stage
+const isTouch = typeof window !== 'undefined' &&
+ ('ontouchstart' in window || (navigator.maxTouchPoints || 0) > 0);
+
const canvas = document.getElementById('club-door-canvas');
const door = document.getElementById('club-door');
-// The bouncer admits via a one-shot event. Capture it at module scope so an
-// admit that fires before the scene finishes its first load is never missed.
+// The bouncer admits via a one-shot event; capture it at module scope so an
+// admit that fires before the scene loads is never missed.
let admitted = false;
let onAdmit = null;
window.addEventListener('club:admitted', () => {
@@ -64,12 +77,13 @@ window.addEventListener('club:admitted', () => {
if (onAdmit) onAdmit();
}, { once: true });
-// No canvas, or the wallet already paid cover tonight (door auto-dismissed) —
-// nothing to render. Drop the canvas so it never sits dead over the stage.
if (canvas && door && !hasValidPass()) {
start(canvas).catch((err) => {
log.warn('[club-entrance] scene failed', err);
+ // Scene is dead — let the player into the cover flow directly so they're
+ // never stuck in a broken alley.
try { canvas.remove(); } catch {}
+ window.dispatchEvent(new CustomEvent('club:enter-door'));
});
} else {
canvas?.remove();
@@ -95,94 +109,243 @@ async function start(canvasEl) {
renderer.toneMappingExposure = 1.12;
const scene = new Scene();
- scene.background = null; // canvas alpha — the page's dark bg shows at the edges
- scene.fog = new Fog(0x05030a, 7, 30);
+ scene.background = null;
+ scene.fog = new Fog(0x05030a, 8, 34);
- const camera = new PerspectiveCamera(52, window.innerWidth / window.innerHeight, 0.05, 200);
+ const camera = new PerspectiveCamera(55, window.innerWidth / window.innerHeight, 0.05, 200);
- // ── Light rig — moody, works for both the alley and the interior ─────────
- scene.add(new AmbientLight(0x241433, 0.65));
- const hemi = new HemisphereLight(0xff6abf, 0x0a0512, 0.4);
+ // ── Light rig — moody, works for the alley and the interior ──────────────
+ scene.add(new AmbientLight(0x241433, 0.7));
+ const hemi = new HemisphereLight(0xff6abf, 0x0a0512, 0.45);
hemi.position.set(0, ROOM_HEIGHT, 0);
scene.add(hemi);
- // Neon accents — the club signature.
- const pink = new PointLight(0xff3bd6, 7, 22, 1.4);
+ const pink = new PointLight(0xff3bd6, 7, 26, 1.4);
pink.position.set(-3, 3.2, -3);
scene.add(pink);
- const cyan = new PointLight(0x4ad6ff, 5, 20, 1.5);
+ const cyan = new PointLight(0x4ad6ff, 5, 24, 1.5);
cyan.position.set(3, 2.4, 2);
scene.add(cyan);
- // A soft forward "lantern" parented to the camera so whatever you walk
- // toward is always lit — reads like carrying your gaze through the dark.
- const lantern = new SpotLight(0xffe6c2, 9, 22, Math.PI / 5, 0.6, 1.2);
- lantern.position.set(0, 0.2, 0.4);
- lantern.target.position.set(0, 0, -6);
- camera.add(lantern, lantern.target);
- scene.add(camera);
+ // A soft key that tracks the avatar so it never falls into shadow.
+ const key = new SpotLight(0xffe6c2, 10, 26, Math.PI / 5, 0.6, 1.2);
+ key.position.set(0, 5, 0);
+ scene.add(key, key.target);
const loader = gltfLoader(renderer);
- // Land in the alley first; prefetch the interior so the walk-through after
- // the cover settles never has to wait on a download.
- const alleyGltf = await loader.loadAsync(ALLEYWAY_URL);
+ // Land in the alley + the avatar first; prefetch the interior so the
+ // walk-through after the cover settles never waits on a download.
+ const [alleyGltf, avatarGltf, manifest] = await Promise.all([
+ loader.loadAsync(ALLEYWAY_URL),
+ loader.loadAsync(AVATAR_URL),
+ fetch(MANIFEST_URL, { cache: 'force-cache' }).then((r) => (r.ok ? r.json() : [])).catch(() => []),
+ ]);
const clubhousePromise = loader.loadAsync(CLUBHOUSE_URL);
+ // ── Environment ──────────────────────────────────────────────────────────
let env = mountEnvironment(scene, alleyGltf.scene);
let path = walkPath(env.box);
- camera.position.copy(path.start);
- camera.lookAt(path.look);
- // ── State machine ────────────────────────────────────────────────────────
- // Segments are driven by wall-clock elapsed time, not accumulated frame
- // deltas, so the journey always runs its authored duration even when the
- // GPU is slow — low fps just means a choppier walk, never slow-motion.
+ // ── Avatar ─────────────────────────────────────────────────────────────
+ const avatar = avatarGltf.scene;
+ scaleToHeight(avatar, AVATAR_HEIGHT);
+ placeOnFloor(avatar);
+ const rig = new Group(); // yaw the rig; the model sits at the rig origin
+ rig.add(avatar);
+ scene.add(rig);
+
+ const anim = new AnimationManager();
+ anim.attach(avatar);
+ anim.setAnimationDefs((Array.isArray(manifest) ? manifest : []).filter((d) => MOVE_CLIPS.has(d.name)));
+ anim.play('idle').catch(() => {});
+
+ // ── Door marker — a neon frame at the end of the alley you walk up to ────
+ const doorMarker = buildDoorMarker();
+ scene.add(doorMarker.group);
+ const doorGlow = new PointLight(0xff4fd8, 0, 9, 1.6);
+ scene.add(doorGlow);
+
+ // ── Camera + controller state ────────────────────────────────────────────
+ let camYaw = Math.atan2(path.dir.x, path.dir.z); // start looking down the alley toward the door
+ let camPitch = 0.12;
+ let inputEnabled = true;
+ let autoWalk = false; // forced forward motion during the walk-through
+
+ placeSpawn();
+
+ function placeSpawn() {
+ rig.position.copy(path.spawn);
+ // Face the door (opposite the walk axis).
+ rig.rotation.y = Math.atan2(-path.dir.x, -path.dir.z);
+ doorMarker.group.position.copy(path.door);
+ doorMarker.group.rotation.y = Math.atan2(path.dir.x, path.dir.z);
+ doorGlow.position.copy(path.door).setY(1.6);
+ camYaw = Math.atan2(path.dir.x, path.dir.z);
+ updateCamera(1);
+ }
+
+ // ── Input ──────────────────────────────────────────────────────────────
+ const keys = new Set();
+ const joy = { active: false, id: null, ox: 0, oy: 0, nx: 0, ny: 0 };
+ const look = { id: null, x: 0, y: 0, moved: false };
+
+ const onKeyDown = (e) => {
+ const k = e.key.toLowerCase();
+ if (k === 'e') { tryEnter(); return; }
+ if (['w', 'a', 's', 'd', 'arrowup', 'arrowdown', 'arrowleft', 'arrowright'].includes(k)) {
+ keys.add(k);
+ e.preventDefault();
+ }
+ };
+ const onKeyUp = (e) => keys.delete(e.key.toLowerCase());
+ window.addEventListener('keydown', onKeyDown);
+ window.addEventListener('keyup', onKeyUp);
+
+ // Pointer: a drag on the left third of the screen drives the joystick (touch
+ // only); anything else orbits the camera.
+ const joyBase = document.getElementById('club-joystick');
+ const joyKnob = document.getElementById('club-joystick-knob');
+
+ const onPointerDown = (e) => {
+ if (!inputEnabled) return;
+ const leftZone = isTouch && e.clientX < window.innerWidth * 0.4;
+ if (leftZone && !joy.active) {
+ joy.active = true; joy.id = e.pointerId; joy.ox = e.clientX; joy.oy = e.clientY;
+ joy.nx = 0; joy.ny = 0;
+ if (joyBase) { joyBase.style.left = `${e.clientX}px`; joyBase.style.top = `${e.clientY}px`; joyBase.classList.add('is-active'); }
+ } else if (look.id === null) {
+ look.id = e.pointerId; look.x = e.clientX; look.y = e.clientY; look.moved = false;
+ }
+ canvasEl.setPointerCapture?.(e.pointerId);
+ };
+ const onPointerMove = (e) => {
+ if (joy.active && e.pointerId === joy.id) {
+ const dx = e.clientX - joy.ox, dy = e.clientY - joy.oy;
+ const max = 56;
+ const len = Math.hypot(dx, dy) || 1;
+ const cl = Math.min(len, max);
+ joy.nx = (dx / len) * (cl / max);
+ joy.ny = (dy / len) * (cl / max);
+ if (joyKnob) joyKnob.style.transform = `translate(${(dx / len) * cl}px, ${(dy / len) * cl}px)`;
+ } else if (e.pointerId === look.id) {
+ const dx = e.clientX - look.x, dy = e.clientY - look.y;
+ if (Math.abs(dx) + Math.abs(dy) > 3) look.moved = true;
+ camYaw -= dx * 0.005;
+ camPitch = clamp(camPitch + dy * 0.004, -0.12, 0.6);
+ look.x = e.clientX; look.y = e.clientY;
+ }
+ };
+ const endPointer = (e) => {
+ if (e.pointerId === joy.id) {
+ joy.active = false; joy.id = null; joy.nx = 0; joy.ny = 0;
+ if (joyBase) joyBase.classList.remove('is-active');
+ if (joyKnob) joyKnob.style.transform = 'translate(0,0)';
+ }
+ if (e.pointerId === look.id) look.id = null;
+ };
+ canvasEl.addEventListener('pointerdown', onPointerDown);
+ canvasEl.addEventListener('pointermove', onPointerMove);
+ canvasEl.addEventListener('pointerup', endPointer);
+ canvasEl.addEventListener('pointercancel', endPointer);
+
+ // Click the neon door directly to enter.
+ const raycaster = new Raycaster();
+ const onClick = (e) => {
+ if (!inputEnabled || look.moved) return;
+ const ndc = new Vector2((e.clientX / window.innerWidth) * 2 - 1, -(e.clientY / window.innerHeight) * 2 + 1);
+ raycaster.setFromCamera(ndc, camera);
+ if (raycaster.intersectObject(doorMarker.group, true).length) tryEnter();
+ };
+ canvasEl.addEventListener('click', onClick);
+
+ // The on-screen prompt button (also the mobile tap target).
+ const promptEl = document.getElementById('club-door-prompt');
+ const hintEl = document.getElementById('club-controls-hint');
+ promptEl?.addEventListener('click', tryEnter);
+ if (hintEl) hintEl.textContent = isTouch
+ ? 'Drag to move and look · walk to the door to enter'
+ : 'WASD / arrows to move · drag to look · press E at the door';
+ showHint(true);
+ showJoystick(isTouch);
+
+ let nearDoor = false;
+ function tryEnter() {
+ if (!inputEnabled || !nearDoor) return;
+ inputEnabled = false;
+ showPrompt(false);
+ showHint(false);
+ showJoystick(false);
+ // Hand off to the cover-charge card.
+ window.dispatchEvent(new CustomEvent('club:enter-door'));
+ }
+
+ // Backed out of the cover card without paying — resume walking the alley.
+ window.addEventListener('club:leave-door', () => {
+ if (phase !== 'alley') return;
+ inputEnabled = true;
+ showHint(true);
+ showJoystick(isTouch);
+ });
+
+ // ── State + render loop ──────────────────────────────────────────────────
let phase = 'alley'; // alley → leaving → swapping → entering → walking → arriving → done
let phaseStart = performance.now();
let raf = 0;
+ let last = performance.now();
- function setPhase(p) {
- phase = p;
- phaseStart = performance.now();
- }
+ function setPhase(p) { phase = p; phaseStart = performance.now(); }
function frame(now) {
- const t = now / 1000;
+ // Cap at 0.1s so a single hitch (or a backgrounded tab) never teleports
+ // the avatar, while keeping movement full-speed down to ~10 fps.
+ const dt = Math.min((now - last) / 1000, 0.1);
+ last = now;
const elapsed = (now - phaseStart) / 1000;
+ // Movement input (manual in the alley, forced during the walk-through).
+ let ix = 0, iz = 0;
+ if (autoWalk) {
+ iz = 1;
+ } else if (inputEnabled) {
+ if (keys.has('w') || keys.has('arrowup')) iz += 1;
+ if (keys.has('s') || keys.has('arrowdown')) iz -= 1;
+ if (keys.has('a') || keys.has('arrowleft')) ix -= 1;
+ if (keys.has('d') || keys.has('arrowright')) ix += 1;
+ if (joy.active) { ix += joy.nx; iz += -joy.ny; }
+ }
+ stepAvatar(ix, iz, dt);
+ anim.update(dt);
+ updateCamera(dt);
+
+ // Key light + proximity prompt follow the avatar in the alley.
+ key.position.set(rig.position.x, 5, rig.position.z + 1);
+ key.target.position.copy(rig.position).setY(1);
+
+ if (phase === 'alley') {
+ const d = Math.hypot(rig.position.x - path.door.x, rig.position.z - path.door.z);
+ const inRange = d < DOOR_RANGE;
+ if (inRange !== nearDoor) { nearDoor = inRange; showPrompt(inRange && inputEnabled); }
+ doorGlow.intensity = inRange ? 3.2 : 1.4;
+ doorMarker.pulse(now / 1000, inRange);
+ }
+
switch (phase) {
- case 'alley':
- // Stand in the alley with a slow handheld sway.
- idleSway(camera, path, t);
- break;
case 'leaving': {
const k = Math.min(1, elapsed / LEAVE);
- idleSway(camera, path, t);
canvasEl.style.opacity = String(1 - k);
if (k >= 1) doSwap();
break;
}
- case 'swapping':
- // Held at black while the interior finishes loading.
- break;
case 'entering': {
const k = Math.min(1, elapsed / ENTER);
- camera.position.copy(path.start);
- camera.lookAt(path.look);
canvasEl.style.opacity = String(k);
if (k >= 1) setPhase('walking');
break;
}
- case 'walking': {
- const k = Math.min(1, elapsed / WALK);
- camera.position.lerpVectors(path.start, path.end, easeInOut(k));
- camera.position.y = EYE + Math.sin(t * 5.2) * 0.025; // a little life in the step
- camera.lookAt(path.look);
- if (k >= 1) setPhase('arriving');
+ case 'walking':
+ if (elapsed >= WALK) setPhase('arriving');
break;
- }
case 'arriving': {
const k = Math.min(1, elapsed / ARRIVE);
- camera.lookAt(path.look);
canvasEl.style.opacity = String(1 - k);
if (k >= 1) return dispose();
break;
@@ -194,12 +357,44 @@ async function start(canvasEl) {
}
raf = requestAnimationFrame(frame);
+ // Move + face the avatar, clamp to the corridor, and drive the walk clip.
+ function stepAvatar(ix, iz, dt) {
+ const len = Math.hypot(ix, iz);
+ if (len < 0.04) {
+ anim.crossfadeTo('idle', 0.25).catch(() => {});
+ return;
+ }
+ const nx = ix / len, nz = iz / len;
+ const sinY = Math.sin(camYaw), cosY = Math.cos(camYaw);
+ // forward (into screen) = (-sinY, 0, -cosY); right = (cosY, 0, -sinY)
+ const wx = -sinY * nz + cosY * nx;
+ const wz = -cosY * nz - sinY * nx;
+ const speed = MOVE_SPEED * Math.min(1, len);
+ rig.position.x = clamp(rig.position.x + wx * speed * dt, env.bounds.minX, env.bounds.maxX);
+ rig.position.z = clamp(rig.position.z + wz * speed * dt, env.bounds.minZ, env.bounds.maxZ);
+ // Face travel direction (shortest-arc yaw lerp).
+ const targetYaw = Math.atan2(wx, wz);
+ rig.rotation.y = lerpAngle(rig.rotation.y, targetYaw, 1 - Math.exp(-12 * dt));
+ anim.crossfadeTo('walk', 0.2).catch(() => {});
+ }
+
+ function updateCamera(dt) {
+ const cosP = Math.cos(camPitch);
+ const off = new Vector3(Math.sin(camYaw) * cosP, Math.sin(camPitch) + 0.0, Math.cos(camYaw) * cosP);
+ const target = new Vector3(rig.position.x, HEAD_Y, rig.position.z);
+ const desired = target.clone().addScaledVector(off, CAM_DIST).setY(CAM_HEIGHT + Math.sin(camPitch) * CAM_DIST);
+ const a = 1 - Math.exp(-9 * dt);
+ camera.position.lerp(desired, a);
+ camera.lookAt(target);
+ }
+
function beginWalk() {
if (phase !== 'alley') return;
+ inputEnabled = false;
+ autoWalk = true;
+ showPrompt(false); showHint(false); showJoystick(false);
setPhase('leaving');
}
- // If the admit already fired during load, start immediately; otherwise the
- // module-scope listener calls us when it does.
onAdmit = beginWalk;
if (admitted) beginWalk();
@@ -210,16 +405,17 @@ async function start(canvasEl) {
try {
clubScene = (await clubhousePromise).scene;
} catch (err) {
- // Interior failed — skip the walk-through and reveal the stage.
log.warn('[club-entrance] club house load failed', err);
return dispose();
}
+ scene.remove(doorMarker.group);
+ disposeObject(doorMarker.group);
+ doorGlow.intensity = 0;
disposeObject(env.root);
scene.remove(env.root);
env = mountEnvironment(scene, clubScene);
path = walkPath(env.box);
- camera.position.copy(path.start);
- camera.lookAt(path.look);
+ placeSpawn();
setPhase('entering');
}
@@ -233,53 +429,99 @@ async function start(canvasEl) {
function dispose() {
cancelAnimationFrame(raf);
window.removeEventListener('resize', onResize);
+ window.removeEventListener('keydown', onKeyDown);
+ window.removeEventListener('keyup', onKeyUp);
onAdmit = null;
+ try { anim.dispose?.(); } catch {}
disposeObject(scene);
renderer.dispose();
try { canvasEl.remove(); } catch {}
+ showHint(false); showJoystick(false); showPrompt(false);
}
}
+// ── UI helpers ─────────────────────────────────────────────────────────────
+function showPrompt(v) { toggle('club-door-prompt', v); }
+function showHint(v) { toggle('club-controls-hint', v); }
+function showJoystick(v) { toggle('club-joystick', v); }
+function toggle(id, v) {
+ const el = document.getElementById(id);
+ if (el) el.classList.toggle('is-visible', !!v);
+}
+
+// ── Scene helpers ────────────────────────────────────────────────────────────
+
// Normalise an environment to a human-scaled room (height = ROOM_HEIGHT),
-// recentre it on the floor at the origin, add it, and return its world box.
+// recentre on the floor at the origin, add it, and return its box + the
+// movement bounds (a margin inside the footprint so you don't clip walls).
function mountEnvironment(scene, root) {
const box = new Box3().setFromObject(root);
const size = box.getSize(new Vector3());
- const s = ROOM_HEIGHT / (size.y || 1);
- root.scale.setScalar(s);
- const box2 = new Box3().setFromObject(root);
- const center = box2.getCenter(new Vector3());
- root.position.x -= center.x;
- root.position.z -= center.z;
- root.position.y -= box2.min.y; // floor at y = 0
+ root.scale.setScalar(ROOM_HEIGHT / (size.y || 1));
+ const b2 = new Box3().setFromObject(root);
+ const c = b2.getCenter(new Vector3());
+ root.position.x -= c.x;
+ root.position.z -= c.z;
+ root.position.y -= b2.min.y;
const group = new Group();
group.add(root);
scene.add(group);
- return { root: group, box: new Box3().setFromObject(group) };
+ const wb = new Box3().setFromObject(group);
+ const mx = (wb.max.x - wb.min.x) * 0.12;
+ const mz = (wb.max.z - wb.min.z) * 0.12;
+ return {
+ root: group,
+ box: wb,
+ bounds: { minX: wb.min.x + mx, maxX: wb.max.x - mx, minZ: wb.min.z + mz, maxZ: wb.max.z - mz },
+ };
}
-// Build a forward dolly along the environment's longer horizontal axis — the
-// "depth" you walk down — independent of the model's authored orientation.
+// Spawn point, door point, and walk axis derived from the longer horizontal
+// dimension — independent of the model's authored orientation.
function walkPath(box) {
const size = box.getSize(new Vector3());
const alongX = size.x > size.z;
const span = (alongX ? size.x : size.z) / 2;
const dir = alongX ? new Vector3(1, 0, 0) : new Vector3(0, 0, 1);
- // Start just inside the near end, walk most of the way toward the far end.
- const start = dir.clone().multiplyScalar(span * 0.85).setY(EYE);
- const end = dir.clone().multiplyScalar(-span * 0.35).setY(EYE);
- // Always look further down the axis you're walking.
- const look = dir.clone().multiplyScalar(-span).setY(EYE * 0.92);
- return { start, end, look, dir };
+ const spawn = dir.clone().multiplyScalar(span * 0.6).setY(0);
+ const doorP = dir.clone().multiplyScalar(-span * 0.82).setY(0);
+ return { dir, span, spawn, door: doorP, start: spawn, end: doorP };
}
-// Subtle standing sway: a slow lateral/vertical drift while you wait.
-function idleSway(camera, path, t) {
- const lateral = new Vector3(-path.dir.z, 0, path.dir.x); // perpendicular, on the floor plane
- camera.position.copy(path.start)
- .addScaledVector(lateral, Math.sin(t * 0.35) * 0.18)
- .setY(EYE + Math.sin(t * 0.5) * 0.03);
- camera.lookAt(path.look);
+// A neon doorway: two posts, a lintel, and a glowing infill plane, with a
+// gentle emissive pulse. Built from primitives so it works over any alley.
+function buildDoorMarker() {
+ const group = new Group();
+ const frameMat = new MeshStandardMaterial({ color: 0x18121f, roughness: 0.5, metalness: 0.3, emissive: 0xff2fd0, emissiveIntensity: 0.5 });
+ const glowMat = new MeshStandardMaterial({ color: 0x2a0a2a, emissive: 0xff5fe0, emissiveIntensity: 1.2, roughness: 0.4 });
+ const post = (x) => {
+ const m = new Mesh(new BoxGeometry(0.18, 2.7, 0.18), frameMat);
+ m.position.set(x, 1.35, 0);
+ return m;
+ };
+ const lintel = new Mesh(new BoxGeometry(1.5, 0.22, 0.2), frameMat);
+ lintel.position.set(0, 2.62, 0);
+ const infill = new Mesh(new BoxGeometry(1.2, 2.5, 0.04), glowMat);
+ infill.position.set(0, 1.3, 0.02);
+ group.add(post(-0.66), post(0.66), lintel, infill);
+ return {
+ group,
+ pulse(t, hot) {
+ const base = hot ? 2.2 : 1.0;
+ glowMat.emissiveIntensity = base + Math.sin(t * 2.4) * 0.35;
+ frameMat.emissiveIntensity = (hot ? 1.0 : 0.5) + Math.sin(t * 2.4) * 0.15;
+ },
+ };
+}
+
+function scaleToHeight(obj, h) {
+ const b = new Box3().setFromObject(obj);
+ const cur = b.max.y - b.min.y || 1;
+ obj.scale.multiplyScalar(h / cur);
+}
+function placeOnFloor(obj) {
+ const b = new Box3().setFromObject(obj);
+ obj.position.y -= b.min.y;
}
function disposeObject(obj) {
@@ -296,6 +538,10 @@ function disposeObject(obj) {
});
}
-function easeInOut(x) {
- return x < 0.5 ? 2 * x * x : 1 - Math.pow(-2 * x + 2, 2) / 2;
+function clamp(v, lo, hi) { return v < lo ? lo : v > hi ? hi : v; }
+function lerpAngle(a, b, t) {
+ let d = (b - a) % (Math.PI * 2);
+ if (d > Math.PI) d -= Math.PI * 2;
+ if (d < -Math.PI) d += Math.PI * 2;
+ return a + d * t;
}
diff --git a/src/club-gate.js b/src/club-gate.js
index f36022fb6..ec264ef11 100644
--- a/src/club-gate.js
+++ b/src/club-gate.js
@@ -24,6 +24,7 @@ function initDoor(root) {
const payBtn = root.querySelector('#club-door-pay');
const msgEl = root.querySelector('#club-door-msg');
const tierEl = root.querySelector('#club-door-tier');
+ const backBtn = root.querySelector('#club-door-back');
// Already paid cover tonight? Drop the rope immediately — no double charge.
const cached = readPass();
@@ -32,11 +33,27 @@ function initDoor(root) {
return;
}
- setState(root, 'queue');
- // Focus the pay button so keyboard users land on the one action.
- try { payBtn?.focus({ preventScroll: true }); } catch {}
-
+ // The card stays hidden until you walk your avatar up to the door in the
+ // alley (src/club-entrance.js → club:enter-door). Backing out (the card's
+ // back button or Escape) returns control to the alley.
+ setState(root, 'hidden');
payBtn?.addEventListener('click', () => payCover(root, { payBtn, msgEl, tierEl }));
+
+ window.addEventListener('club:enter-door', () => {
+ if (root.dataset.state !== 'hidden') return;
+ setState(root, 'queue');
+ try { payBtn?.focus({ preventScroll: true }); } catch {}
+ });
+
+ const backToAlley = () => {
+ setState(root, 'hidden');
+ setMsg(msgEl, '', null);
+ window.dispatchEvent(new CustomEvent('club:leave-door'));
+ };
+ backBtn?.addEventListener('click', backToAlley);
+ window.addEventListener('keydown', (e) => {
+ if (e.key === 'Escape' && root.dataset.state === 'queue') backToAlley();
+ });
}
async function payCover(root, { payBtn, msgEl, tierEl }) {
diff --git a/src/irl.js b/src/irl.js
index 975b40e91..0a2f11d30 100644
--- a/src/irl.js
+++ b/src/irl.js
@@ -417,13 +417,17 @@ const input = {
keys: { forward: 0, back: 0, left: 0, right: 0, run: false },
};
-nipplejs.create({
+// nipplejs's .on() returns undefined (not chainable), so attach each listener
+// on the stored manager — chaining would throw and abort the module's boot.
+const joystick = nipplejs.create({
zone: joystickEl, mode: 'static', position: { left: '50%', top: '50%' },
size: 110, color: 'rgba(255,255,255,0.85)', restOpacity: 0.6,
-}).on('move', evt => {
+});
+joystick.on('move', evt => {
const v = evt?.data?.vector;
if (v) { input.joy.x = v.x; input.joy.y = v.y; input.joy.active = Math.hypot(v.x, v.y) > 0.05; }
-}).on('end', () => { input.joy.x = 0; input.joy.y = 0; input.joy.active = false; });
+});
+joystick.on('end', () => { input.joy.x = 0; input.joy.y = 0; input.joy.active = false; });
window.addEventListener('keydown', e => {
switch (e.code) {