@needle-tools/engine 5.1.9 → 5.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/SKILL.md +62 -4
- package/components.needle.json +1 -1
- package/dist/{needle-engine.bundle-XZ6cKssu.js → needle-engine.bundle-DP--RGAU.js} +3144 -3021
- package/dist/{needle-engine.bundle-CHq9xqXv.min.js → needle-engine.bundle-DZD-GG7l.min.js} +122 -121
- package/dist/{needle-engine.bundle-DYPk7VZg.umd.cjs → needle-engine.bundle-Dv5TidOk.umd.cjs} +132 -131
- package/dist/needle-engine.d.ts +90 -17
- package/dist/needle-engine.js +610 -606
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/three-examples.js +727 -781
- package/dist/three-examples.min.js +12 -12
- package/dist/three-examples.umd.cjs +9 -9
- package/lib/engine/api.d.ts +1 -1
- package/lib/engine/api.js +1 -1
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/engine_init.js +2 -2
- package/lib/engine/engine_init.js.map +1 -1
- package/lib/engine/engine_license.d.ts +7 -7
- package/lib/engine/engine_license.js +71 -71
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine/engine_materialpropertyblock.d.ts +13 -4
- package/lib/engine/engine_materialpropertyblock.js +16 -5
- package/lib/engine/engine_materialpropertyblock.js.map +1 -1
- package/lib/engine/engine_networking_blob.js +3 -3
- package/lib/engine/engine_networking_blob.js.map +1 -1
- package/lib/engine/engine_utils_qrcode.js +2 -2
- package/lib/engine/engine_utils_qrcode.js.map +1 -1
- package/lib/engine/postprocessing/postprocessing.d.ts +18 -0
- package/lib/engine/postprocessing/postprocessing.js +31 -2
- package/lib/engine/postprocessing/postprocessing.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu.js +5 -5
- package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.js +2 -2
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
- package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
- package/lib/engine/xr/TempXRContext.js +2 -2
- package/lib/engine/xr/TempXRContext.js.map +1 -1
- package/lib/engine/xr/XRHandMeshModel.d.ts +31 -0
- package/lib/engine/xr/XRHandMeshModel.js +153 -0
- package/lib/engine/xr/XRHandMeshModel.js.map +1 -0
- package/lib/engine-components/ReflectionProbe.js +3 -3
- package/lib/engine-components/ReflectionProbe.js.map +1 -1
- package/lib/engine-components/RendererLightmap.js +1 -1
- package/lib/engine-components/RendererLightmap.js.map +1 -1
- package/lib/engine-components/SyncedRoom.js +5 -0
- package/lib/engine-components/SyncedRoom.js.map +1 -1
- package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
- package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/DepthOfField.js +10 -2
- package/lib/engine-components/postprocessing/Effects/DepthOfField.js.map +1 -1
- package/lib/engine-components/postprocessing/index.d.ts +4 -0
- package/lib/engine-components/postprocessing/index.js +7 -0
- package/lib/engine-components/postprocessing/index.js.map +1 -1
- package/lib/engine-components/utils/LookAt.d.ts +13 -4
- package/lib/engine-components/utils/LookAt.js +13 -4
- package/lib/engine-components/utils/LookAt.js.map +1 -1
- package/lib/engine-components/webxr/WebXR.js +1 -1
- package/lib/engine-components/webxr/WebXR.js.map +1 -1
- package/lib/engine-components/webxr/controllers/XRControllerModel.d.ts +1 -1
- package/lib/engine-components/webxr/controllers/XRControllerModel.js +12 -7
- package/lib/engine-components/webxr/controllers/XRControllerModel.js.map +1 -1
- package/package.json +2 -2
- package/plugins/common/license.js +4 -4
- package/plugins/vite/license.js +4 -4
- package/src/engine/api.ts +1 -1
- package/src/engine/engine_init.ts +2 -2
- package/src/engine/engine_license.ts +68 -68
- package/src/engine/engine_materialpropertyblock.ts +17 -5
- package/src/engine/engine_networking_blob.ts +3 -3
- package/src/engine/engine_utils_qrcode.ts +2 -2
- package/src/engine/postprocessing/postprocessing.ts +32 -2
- package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
- package/src/engine/webcomponents/needle menu/needle-menu.ts +5 -5
- package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
- package/src/engine/webcomponents/needle-engine.ts +2 -2
- package/src/engine/xr/TempXRContext.ts +2 -2
- package/src/engine/xr/XRHandMeshModel.ts +179 -0
- package/src/engine-components/ReflectionProbe.ts +3 -3
- package/src/engine-components/RendererLightmap.ts +1 -1
- package/src/engine-components/SyncedRoom.ts +5 -0
- package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
- package/src/engine-components/postprocessing/Effects/DepthOfField.ts +10 -2
- package/src/engine-components/postprocessing/index.ts +7 -0
- package/src/engine-components/utils/LookAt.ts +13 -4
- package/src/engine-components/webxr/WebXR.ts +1 -1
- package/src/engine-components/webxr/controllers/XRControllerModel.ts +13 -7
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes to this package will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [5.1.10] - 2026-08-07
|
|
8
|
+
- Add: turn the whole postprocessing stack on or off at runtime with `PostProcessing.enabled`
|
|
9
|
+
- Fix: scene brightness no longer shifts when XR hand models are shown or hidden
|
|
10
|
+
- Fix: the `showHandModels` toggle now reliably shows or hides XR hand models
|
|
11
|
+
- Change: `SyncedRoom` warns (in development) when a room-name URL parameter overrides the `roomName` set on the component, making it easier to diagnose ending up in an unexpected room
|
|
12
|
+
|
|
7
13
|
## [5.1.9] - 2026-07-30
|
|
8
14
|
**Added**
|
|
9
15
|
- `WebXRImageTracking`: friendlier `addImage` API for registering marker images
|
package/SKILL.md
CHANGED
|
@@ -13,7 +13,10 @@ description: >
|
|
|
13
13
|
or error without mentioning Needle Engine — check if @needle-tools/engine is in
|
|
14
14
|
package.json or imports. If the project uses Needle Engine, always load this skill.
|
|
15
15
|
compatibility:
|
|
16
|
-
- optional:
|
|
16
|
+
- optional: >
|
|
17
|
+
needle_search MCP tool (search Needle Engine docs, forum posts, and community answers).
|
|
18
|
+
Without it, the same corpus is reachable over HTTP at
|
|
19
|
+
https://search.needle.tools/api/semantic-search?q=... (public, no key) — see references/mcp.md
|
|
17
20
|
---
|
|
18
21
|
|
|
19
22
|
# Needle Engine
|
|
@@ -47,6 +50,33 @@ export class HelloWorld extends Behaviour {
|
|
|
47
50
|
|
|
48
51
|
> ⚠️ **TypeScript config required:** `tsconfig.json` must have `"experimentalDecorators": true` and `"useDefineForClassFields": false` for decorators to work. Without `useDefineForClassFields: false`, TypeScript overwrites `@serializable()` properties with their default values *after* the decorator runs, silently breaking deserialization.
|
|
49
52
|
|
|
53
|
+
On **5.1+**, scenes expose auto-generated typed bindings, and `needle` gives you the context from
|
|
54
|
+
anywhere — often shorter than `getComponent` lookups:
|
|
55
|
+
```ts
|
|
56
|
+
import { needle, onStart } from "@needle-tools/engine";
|
|
57
|
+
|
|
58
|
+
// `needle` resolves to the current context when the handler runs — no wrapper needed
|
|
59
|
+
button.onclick = () => {
|
|
60
|
+
needle.sceneData.MyScene.MainCamera.$components.OrbitControls.autoRotate = false;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// Without it, you'd wrap the wiring in onStart purely to capture a ctx:
|
|
64
|
+
onStart(ctx => {
|
|
65
|
+
button.onclick = () => {
|
|
66
|
+
ctx.sceneData.MyScene.MainCamera.$components.OrbitControls.autoRotate = false;
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
`onStart(ctx => …)` is still the right tool for setup that must run once the scene is ready —
|
|
71
|
+
`needle` is for reaching the context from code that runs later.
|
|
72
|
+
> ⚠️ **Don't touch `needle` at module top-level.** It's a lazy Proxy resolving to the *current*
|
|
73
|
+
> context — module bodies evaluate before any scene exists, so it logs an error and returns a
|
|
74
|
+
> no-op proxy. Use it inside callbacks and event handlers; use `onStart(ctx => …)` for setup.
|
|
75
|
+
> (Importing it at top level is fine, including under SSR — only *access* is the problem.)
|
|
76
|
+
|
|
77
|
+
Components need `$components`; bare names are child nodes. Both APIs are experimental — see
|
|
78
|
+
[What's New](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/whats-new.md).
|
|
79
|
+
|
|
50
80
|
---
|
|
51
81
|
|
|
52
82
|
## Key Concepts
|
|
@@ -137,7 +167,9 @@ Boolean attributes can be disabled with `="0"` (e.g. `camera-controls="0"`).
|
|
|
137
167
|
| `background-color` | Hex or RGB background color (e.g. `#ff0000`) |
|
|
138
168
|
| `background-image` | Skybox URL or preset: `studio`, `blurred-skybox`, `quicklook`, `quicklook-ar` |
|
|
139
169
|
| `background-blurriness` | Blur intensity for background (0–1) |
|
|
170
|
+
| `background-rotation` | Rotate the background skybox (5.1+) |
|
|
140
171
|
| `environment-image` | Environment lighting image URL or preset (same presets as `background-image`) |
|
|
172
|
+
| `environment-rotation` | Rotate the environment lighting (5.1+) |
|
|
141
173
|
| `contactshadows` | Enable contact shadows |
|
|
142
174
|
| `tone-mapping` | `none`, `linear`, `neutral`, `agx` |
|
|
143
175
|
| `poster` | Placeholder image URL shown while loading |
|
|
@@ -245,6 +277,13 @@ export default defineConfig(async ({ command }) => ({
|
|
|
245
277
|
}));
|
|
246
278
|
```
|
|
247
279
|
|
|
280
|
+
As of 5.1, `needlePlugins()` resolves the Vite command itself, so it can be called with no
|
|
281
|
+
arguments and without `await`/spread — handy when composing with other framework plugins:
|
|
282
|
+
```js
|
|
283
|
+
export default defineConfig({ plugins: [sveltekit(), needlePlugins()] });
|
|
284
|
+
```
|
|
285
|
+
Still pass `(command, config, settings)` when you need options like `makeFilesLocal`.
|
|
286
|
+
|
|
248
287
|
---
|
|
249
288
|
|
|
250
289
|
## `needle.config.json`
|
|
@@ -375,7 +414,9 @@ Use this when you need exact method signatures, constructor parameters, or prope
|
|
|
375
414
|
|
|
376
415
|
## Searching the Documentation
|
|
377
416
|
|
|
378
|
-
|
|
417
|
+
Search the docs *before* guessing at API details — they are the source of truth. The corpus covers Needle Engine documentation, the API reference, the community forum, Discord, and Needle source code.
|
|
418
|
+
|
|
419
|
+
**If the `needle_search` MCP tool is available, use it:**
|
|
379
420
|
|
|
380
421
|
```
|
|
381
422
|
needle_search("how to play animation clip from code")
|
|
@@ -383,12 +424,25 @@ needle_search("SyncedTransform multiplayer")
|
|
|
383
424
|
needle_search("deploy to Needle Cloud CI")
|
|
384
425
|
```
|
|
385
426
|
|
|
386
|
-
|
|
427
|
+
**Otherwise, hit the public search API — no key, no setup:**
|
|
428
|
+
|
|
429
|
+
```bash
|
|
430
|
+
curl -s -H "Accept: application/json" \
|
|
431
|
+
"https://search.needle.tools/api/semantic-search?q=how+to+play+animation+clip+from+code&limit=5"
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
Returns JSON `{ query, results: [{ title, source, content, url, score, truncated }], durationMs }`. Optional `limit` (1–20, default 10) and `max_chars` (200–10000, default 2000). Rate-limited to 10 requests/minute for unauthenticated callers.
|
|
435
|
+
|
|
436
|
+
Both are **semantic** search — phrase queries as full questions ("how do I make an object follow the camera in VR"), not keyword soup ("vr camera follow"). Result `url`s include a `#:~:text=` fragment linking to the exact passage; pass them on to the user.
|
|
437
|
+
|
|
438
|
+
See 🔌 [MCP & Search API](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/mcp.md) for the full tool inventory — project file access, live scene inspection via the Needle Inspector, Unity/Blender tools — and for MCP server setup.
|
|
387
439
|
|
|
388
440
|
---
|
|
389
441
|
|
|
390
442
|
## Common Gotchas
|
|
391
443
|
|
|
444
|
+
- **Scene Bindings: bare names are child nodes, components need `$components`.** `ctx.sceneData.MyGlb.Camera.OrbitControls` looks for a child *object* named OrbitControls; the component is `ctx.sceneData.MyGlb.Camera.$components.OrbitControls`. Worse, misses don't throw — they return an error proxy that swallows every get/set and only warns. If a scene-bindings assignment appears to run but changes nothing, check the console for `[SceneData]`.
|
|
445
|
+
- **`autoCleanup`'s teardown timing depends on where you call it.** In `onEnable` → cleaned on disable. In `awake`/`start` → cleaned on destroy, so it survives disable/enable. Registering a subscription in `start()` and expecting it to stop when the component is disabled is the common mistake.
|
|
392
446
|
- **`obj.visible = false` disables components!** Setting `visible = false` on a parent disables the entire hierarchy including component lifecycle (SyncedTransform, etc.) — like Unity's `setActive`. To hide visually but keep components running, hide child meshes instead: `obj.traverse(c => { if (c.isMesh) c.visible = false; })`. Or use `Renderer.setVisible(obj, false)` which only affects rendering.
|
|
393
447
|
- `@registerType` is required or the component won't be instantiated from GLB. Unity/Blender export adds this automatically via codegen; hand-written components need it explicitly.
|
|
394
448
|
- GLB assets go in `assets/`, static files (fonts, images, videos) in `public/` (configurable via `needle.config.json`)
|
|
@@ -413,6 +467,7 @@ Use this *before* guessing at API details — the docs are the source of truth.
|
|
|
413
467
|
|
|
414
468
|
Read these **only when needed** — don't load them all upfront:
|
|
415
469
|
|
|
470
|
+
- 🆕 [What's New (5.1 → 6.0)](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/whats-new.md) — Scene Bindings (`ctx.sceneData`), `needle` shorthand, `Context.events`, `autoCleanup`, builder APIs, `<needle-app>`, GaussianSplat. **Check this before assuming an API doesn't exist** — much of it postdates the rest of these references.
|
|
416
471
|
- 📖 [Core API](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/api.md) — lifecycle, decorators, context (input, physics, time), gameobject, coroutines, asset loading, renderer/materials, async modules
|
|
417
472
|
- 🧩 [Components](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/components.md) — animation, audio, video, lighting, camera, scene switching, interaction, splines, particles, debug tools
|
|
418
473
|
- ⚡ [Physics](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/physics.md) — colliders, Rigidbody (forces, velocity, impulse), raycasting, async Rapier loading
|
|
@@ -423,11 +478,14 @@ Read these **only when needed** — don't load them all upfront:
|
|
|
423
478
|
- 🔗 [Framework Integration](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/integration.md) — React, Svelte, Vue, Next.js, SvelteKit patterns, CDN with import maps
|
|
424
479
|
- 💡 [Component Examples](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/examples.md) — practical examples: click handling, runtime loading, networking, materials, code-only scenes, input, coroutines
|
|
425
480
|
- 🐛 [Troubleshooting](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/troubleshooting.md) — error messages, unexpected behavior, build failures, **runtime logs at `node_modules/.needle/logs/`**, build info
|
|
481
|
+
- 🔌 [MCP & Search API](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/mcp.md) — `needle_search`, the public search HTTP API, MCP server setup, project file tools, live scene inspection via the Needle Inspector, Unity/Blender tools
|
|
426
482
|
- 🧩 [Component Template](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/templates/my-component.ts) — annotated starting point for new components
|
|
427
483
|
|
|
428
484
|
## Important URLs
|
|
429
485
|
|
|
430
|
-
- Docs: https://engine.needle.tools/docs/
|
|
486
|
+
- Docs: https://engine.needle.tools/docs/ (any page also available as markdown — swap `.html` for `.md`)
|
|
487
|
+
- Search API: https://search.needle.tools/api/semantic-search?q=your+question ([API reference](https://search.needle.tools/api-docs))
|
|
488
|
+
- AI & MCP docs: https://engine.needle.tools/docs/ai/
|
|
431
489
|
- Samples: https://engine.needle.tools/samples/
|
|
432
490
|
- Samples index (all official samples with source): https://github.com/needle-tools/needle-engine-samples/blob/main/samples.json
|
|
433
491
|
- GitHub: https://github.com/needle-tools/needle-engine-support
|