# Needle Engine Documentation
Source: https://docs.needle.tools
---
title: Needle Engine for Blender
editLink: true
---
Get started now • Learn more about our vision • Features Overview • Samples to download
## Needle Website Visit Website — by Needleyour content for AR and desktop goes here
This will only be visible in AR
// END MARKER play_animation_on_trigger
```
2) Push to the `docs/code-marker` branch
3) In the *documentation repository* (this repo) include code blocks by adding a HTML comment in the markdown files. For example:
```html
```
Note: If your code block doesnt show up check the console of the documentation local server. If you just updated the samples repository it may take a few minutes to be available.
You can also insert additional markdown inside of the HTML comment. It will then only be rendered if the sample code can be found.
For example:
```html
```
This is looking for a sample marker with "disable environment light" and if it finds it, it will render the markdown in the subsequent rows and then the code
Needle Engine
[](https://www.npmjs.com/package/@needle-tools/engine)
[](https://www.npmjs.com/package/@needle-tools/engine)
[](https://discord.needle.tools)
[](https://forum.needle.tools)
[Getting Started](https://docs.needle.tools/getting-started/) — [Samples](https://engine.needle.tools/samples) — [Documentation](https://engine.needle.tools/docs)
---
**Needle Engine** is a web-based runtime for 3D apps. It runs on your machine for development, and can be deployed anywhere. It is flexible, extensible and has built-in support for networking and XR!
**Needle Exporter for Unity** bridges the Unity Editor and the web runtime. It helps you to export your assets, animations, lightmaps and so on to the web. It is built around the glTF standard for 3D assets.
**Together**, they enable incredible iteration speeds and help you to bring your content to the web.
Some have called it the "Missing Link" between artist-friendly workflows and modern web development!
# Needle Engine CHANGELOG
Source: https://github.com/needle-tools/needle-engine-support/releases
# Changelog
All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [4.4.0-beta] - 2025-03-28
- Add: `ObjectUtils.createPrimitive()` now supports scale as array
e.g. `ObjectUtils.createPrimitive("Cube", { scale: [1, .25, 1] } );`
- Add: Input `getGamepad()` function to query a connected gamepad. Example: `this.context.input.getGamepad()`
- Add: `lookAtScreenPoint()` function which allows 3D object to look at points in 2D screen coordinates (e.g. your mouse position).
**Example Component that makes the object look at the mouse**
```ts
import { Behaviour, lookAtScreenPoint } from "@needle-tools/engine";
export class LookAtMouse extends Behaviour {
update() {
lookAtScreenPoint(this.gameObject, this.context.input.mousePosition, this.context.mainCamera);
}
}
```
- Add: SyncedTransform does now also sync scale changes
- Add: Default environment lighting. If you don't configure any environment-image needle engine will now create a default scene to light your objects. Previously the scene was just black when the loaded model didn't contain any lighting information.
- Add: The `contactshadows` attribute now allows you to specify a factor for controlling the darkness/lightness. E.g. `` will make the shadows appear darker vs. `` will make the contact shadow appear lighter.
- Fix: Implicit camera did not automatically set to skybox when using `background-image`. E.g. `
- Fix: Tonemapping falsely set tonemappingEsposure to undefined causing a black screen
- Fix: `background-color` attribute was not always applied. E.g. ``
- Change: License check aborts now faster instead of retrying when connection is actively refused
- Change: OrbitControls `autoTarget` does now automatically update the look at target after panning and not when rotating the camera (previously the target would be updated after any input but this resultet in undesireable behaviour when rotating around objects)
- Change: When no background-color is defined by either the loaded scene or by a `background-color` attribute then the default scene background color respects the user's accessibility setting for `prefer-dark` or `prefer-light`. This means that the background color will be set to a default light or dark value.
## [4.3.2] - 2025-03-20
#### Added
- Documentation for `Gizmos` API
- `this.context.time.fps` returning the FPS for the current frame (for a more stable FPS value `smoothedFps` can be used)
#### Removed
- Vite license plugin check does not support Node 16 anymore
#### Changes
- Improve Vite preload link injection into HTML head
- The PostprocessingManager component does now expose a `multisampling` property which is set to `"auto"` by default. By setting `multisampling` to a number it will force postprocessing to the configured samples.
- Downloading of `` attributes for `skybox-image` and `environment-image` does now start earlier. Previously it would only start loading the HDRi or EXR images after the root glTF file was finished loading. Now it will start downloading earlier which improves the time until the scene is ready to be displayed.
#### Fixed
- Vite dependency-watcher plugin warning
- Vite license check plugin is now using the latest Needle CLI version
- Browser cache busting issue related to loading the root scene where range requests (e.g. when download urls without a file extension). This caused Chrome to remove files from the disc cache causing a re-download
- Three.js core postprocessing effects support
- Loading glTF files without any components (e.g. when directly downloaded from Sketchfab) was causing Needle Engine to falsely keep a reference to the loaded glTF structure.
- Instancing issue where instancing did sometimes renderer wrong geometry when many objects where removed and added again and multiple different geometries were batched together. This was caused by a bug in the internal bucketing mechanism and has now been removed since it's not necessary anymore.
## [4.3.2-beta.5] - 2025-03-20
- Change: Improve Vite preload link injection into HTML head
- Fix: Vite dependency-watcher plugin warning
## [4.3.2-beta.4] - 2025-03-19
- Fix: Start loading earlier for `skybox-image` and `environment-image` when configured in `` web component. Previously it would only start loading the HDRi or EXR images after the root glTF file was finished loading. Now it will start downloading earlier which improves the time until the scene is ready to be displayed.
- Fix: Update vite license check using the latest CLI version
- Fix: Issue related to loading the root scene where range requests (e.g. when download urls without a file extension) caused Chrome to remove previously full downloads to be removed from disc cache
- Remove: Vite license check does not support Node 16 anymore
## [4.3.2-beta.3] - 2025-03-18
- Fix: Support for three.js core postprocessing effects
## [4.3.2-beta.2] - 2025-03-18
- Add: Documentation for `Gizmos` API
## [4.3.2-beta.1] - 2025-03-17
- Fix: Bug when loading glTF files without any components where a reference to the loaded glTF structre was kept in memory causing the memory to not be freed
## [4.3.2-beta] - 2025-03-14
- Add: `this.context.time.fps` returning the FPS for the current frame (for a more stable FPS value `smoothedFps` can be used)
- Change: The PostprocessingManager component does now expose a `multisampling` property which is set to `"auto"` by default. By setting `multisampling` to a number it will force postprocessing to the configured samples.
- Fix: Issue where instancing with multiple different geometries being batched together did sometimes be cause wrong rendering when many objects where removed and added again. This was caused by a bug in the internal bucketing mechanism which is not necessary anymore with the new BatchedMesh version.
## [4.3.1] - 2025-03-14
- Add: Expose lifecylcle hooks in `Needle` global scope for usage in commonjs or without a bundler. For example this allows to subscribe to the update event with `Needle.onUpdate(ctx => console.log(ctx.time.time))`.
- Fix: OrbitControls micro-movement after a pointer event was already used. For example previously when using DragControls and starting to drag an object the camera would still move slightly before stopping during drag. This is not the case anymore now and the camera does not move anymore during interaction with other objects.
- Fix: Canvas UI render settings not being applied in one rare case causing a worldspace image not being set to double sided rendering.
## [4.3.0] - 2025-03-12
- Bump version to 4.3.0
## [4.3.0-alpha.6] - 2025-03-11
- Change: Postprocessing effects in shared volume (when exported from Unity) are now added to the Volume gameObject during initialization
- Fix: improve Rigidbody physics poststep / smoothed velocity
## [4.3.0-alpha.5] - 2025-03-06
- Add: more jsdoc comments to `Graphics.textureToCanvas` and `Mathf` methods
- Change: AudioSource tries to get AudioListener from it's own object first before it checks camera and scene
- Fix: SpriteRenderer issue where runtime instantiate and setting Sprite would in some cases not update the texture on all instances
- Fix: Issue in `Graphics.copyTexture` where the blit material was not yet created
## [4.3.0-alpha.4] - 2025-03-06
- Revert last AudioSource change
## [4.3.0-alpha.3] - 2025-03-06
- Add: WebARSessionRoot `arScale` can now be changed while in AR to modify or reset the scale.
- Change: AudioSource now creates it's own AudioListener instead of using one from the camera.
## [4.3.0-alpha.1] - 2025-03-03
- Add: More API documentation for various core components
## [4.3.0-alpha] - 2025-02-28
- Add: SceneSwitcher `sceneLoadingStart` and `sceneLoadingProgress` events
- Add: AssetReference `urlName` property
- Fix: SceneSwitcher preloading if configured to not load scene at startup
- Fix: UI issue where text components were not correctly handled by the EventSystem for the `hasActiveUI` property
## [4.2.5] - 2025-02-27
- Fix: keep FBX vertex color assignment when postprocessing materials
- Fix: ContactShadow flicker when point materials are in the scene
- Fix: OrbitControls keep `autoTarget` enabled in `fitCamera`
- Fix: Static `BoxCollider.add` now correctly calculates bounding box
- Fix: InputField `onValueChanged` event is now invoked after the new value has been assigned
- Change: `getBoundingBox` now also takes a single object as well as an array of objects
- Change: DropListener now exposes `DropListenerOnDropArguments` type
## [4.2.4] - 2025-02-21
- Add: OrbitControls set to `autoTarget` now automatically updates rotation target in onPointerUp
- Fix: USDZ add safeguard against potential issue in bone sorting
- Fix: USDZ remove extra check for bone type that might prevent bone structure ordering
- Fix: Static method for `BoxCollider.add` not correctly calculating object bounds when object is rotated
- Fix: Ignore fullscreen plane for WebXR auto center
- Fix: Issue in FBXLoader where loading FBX files with out-of-bounds material assignments lead to incorrect geometry groups and subsequent errors
- Change: Improve input typings for `isKeyDown`, `isKeyUp` and `isKeyPressed`
## [4.2.3] - 2025-02-20
- Add: InputField setter for `text`
- Fix: OrbitControls setCameraAndLookTarget
- Fix: Issue where updating KTX transcoder was not being correctly applied for offline usage
## [4.2.2] - 2025-02-18
- Fix: WebXRImageTracking iOS size calculation due to change by Apple
- Fix: USDZ AudioSource not generating code for `playOnAwake` anymore
- Fix: Lightmap and environment ligthing not working correctly anymore due to change in three v163
- Change: EventSystem simplification - it is now always created once in scene root, this removes the requirement of ObjectRaycasters in the scene which simplifies the usage of component input event methods like `onPointerClick` (which previously required users to ensure there are ObjectRaycasters in the parent hierarchy)
## [4.2.0] - 2025-02-17
- Change: remove MXInk fallback codepath for pre-release OS versions
- Change: don't request "hand-tracking" on VisionOS devices unless explicit custom hand models are requested
- Fix: occluder generation in Plane/Mesh tracking should not be enforced when we have a data template
## [4.1.1] - 2025-02-14
- Fix: ParticleSystem regression where particles using a transparent PBR shader are not being rendered as transparent
## [4.1.0] - 2025-02-13
- Fix: Issue in WebXR component where disabling `usePlacementReticle` would not apply other settings to already existing WebARSessionRoot components in the scene
## [4.1.0-beta.9] - 2025-02-12
- Add: `Object3D.hideFlags` property and ContactShadows sets generated shadow object to `DontExport` to be excluded in runtime glTF export
- Fix: ContactShadows `auto()` does now check if the scene already contains contact shadows
## [4.1.0-beta.8] - 2025-02-12
- Fix: Handle `` web component being present anywhere in the document already
- Fix: Allow nextjs based projects to be deployed to Needle Cloud
- Change: `instantiate()` can now take an AssetReference as an argument as well
- Change: Improve `context.input.addEventListener` function typing
## [4.1.0-beta.6] - 2025-02-05
- Fix: issue with `parseSync` for loading a glTF file is a file path
## [4.1.0-beta.5] - 2025-02-04
- Fix: Physics issue with mesh colliders where colliders were sometimes created with the wrong size depending on the users network speed. This was due to the change of lazily loading the physics engine in Needle Engine 4.
- Fix: Add workaround for a regression in the particle system where PBR materials would sometimes render with a wrong texture. [Issue](https://github.com/Alchemist0823/three.quarks/issues/101)
- Fix: ParticleSystem gradients set to `Random Color`
- Fix: import WebGLNodes to ensure nodes actually run
- Change: Physics engine `addMeshCollider` scale argument is now optional and treated as scale applied to the object's world scale when creating the collider.
## [4.1.0-beta.4] - 2025-02-03
- Add: OrbitControls support for orthographic camera
- Fix: Orthographic camera aspect ratio
## [4.1.0-beta.3] - 2025-01-30
- Fix: issue where networked values with the `@syncField` decorator would not be updated correctly on instances spawned at runtime (e.g. via PlayerSync).
## [4.1.0-beta.2] - 2025-01-29
- Fix: VideoPlayer screenspace mode colorspace
- Fix: XRRig `setAsActiveRig()` now ensures the given rig has the highest priority. Previously it was possibly immediately overidden again if another XRRig with a higher priority was active in the scene.
- Change: SpatialTrigger EventList events are now invoked without additional parameters. They did previously take a reference to the SpatialTriggerReceiver and active SpatialTrigger. If this information is important the SpatialTriggerReceiver can be saved when subscribing to the event and the trigger can be accessed using the `triggerReceiver.currentIntersected` array.
- Change: TransformGizmo now exposes the underlying three.js TransformGizmo via a new `control` property.
- Change: GroundProjection now uses the `scene.background` instead of `scene.environment`
## [4.1.0-beta.1] - 2025-01-29
- Fix: ParticleSystem custom behaviours
- Fix: OrbitControls not keeping the initial look direction if `autoTarget` was off
- Fix: Invalid Rigidbody warning caused by async physics engine loading change
- Fix: SharpeningEffect
- Update gltf-progressive including a fix for loading texture LOD 0 (the highest resolution)
- Update three.quarks dependency to 0.15.6
## [4.1.0-beta] - 2025-01-24
- Promote to beta
## [4.1.0-alpha.14] - 2025-01-24
- Fix: glsl shader error at linear to sRGB conversion
## [4.1.0-alpha.13] - 2025-01-23
- Update three.js dependency to fix issue in WebXRManager
## [4.1.0-alpha.12] - 2025-01-21
- Change: Much improved initial loading speed making Needle Engine websites load up to 1000 ms faster.
Improved Needle Engine website lighthouse scores for all Vite based projects.
Improved bundle chunking and loading for better lighthouse scores.
Core bundles and entrypoint glTF files are not loaded as soon as the web document is ready.
- Change: Needle Engine does now lazily import dependencies for `rapier` and `postprocessing` to reduce download and startup size.
This means that projects that don't use any collider or rigidbody components will not load the physics and postprocessing modules. Modules can be loaded at any time once they're need by e.g. components in the scene.
## [4.1.0-alpha.11] - 2025-01-17
- Remove: legacy Flycontrols component
- Fix: MeshCollider contact normal direction
## [4.1.0-alpha.10] - 2025-01-17
- Fix: Instanced meshes bug where sometimes an vertex count increase due to mesh compression was not handled correctly
## [4.1.0-alpha.9] - 2025-01-15
- Fix: Better AgX and Neutral tonemapping
## [4.1.0-alpha.8] - 2025-01-14
- Update three.js to r169
- Update dependencies: three-mesh-bvh to 0.8.3, three-quarks to 0.15.5, postprocessing to 6.36.6, n8ao to 1.9.3
- Fix: AR screenshot bug where the second screenshot would not look correct
- Fix: nextjs support
## [4.1.0-alpha.5] - 2025-01-13
- Fix: Issue where MeshCollider with InterleavedBufferAttributes were not created correctly
- Fix: multi-object mesh collider handling for Groups and add warning for remaining case that are not supported
- Fix: transparency trimming for screenshot should happen before screenshot is returned
- Change: Reduced mesh LOD vertex reduction to improve quality of lowest LOD
- Update build pipeline to latest 2.7 alpha
- Update rapier dependency to 0.14.0
## [4.1.0-alpha.4] - 2025-01-10
- Add: SceneSwitcher methods for `unload()` and `reload()` the currently loaded scene
## [4.1.0-alpha.1] - 2025-01-09
- Add: Support for loading KTX2 textures as `environment-image` and `background-image` (e.g. ``)
- Fix: Issue where raycasting was not using acceleration structures and instead falling back to slow raycasting. This release greatly improves raycasting performance
## [4.1.0-alpha] - 2025-01-08
- Add: Screenshot support for AR:
To use you need to request the `camera-access` XR feature when starting a new XR session.
For that you can *either* simply add the *WebARCameraBackground* component to your scene
or add the feature in the `NeedleXRSession.onSessionRequestStart` event hook.
## [4.0.4-alpha] - 2025-01-02
- Fix: Detecting OBJ files starting with `mtllib` or content-type header `model/obj`
- Fix: Issue where `screenshot()` method with custom camera and postprocessing didn't work
- Update gltf-progressive package to load higher texture LODs by default
## [4.0.3-alpha] - 2014-12-20
- Add: OBJLoader now automatically loads mtl files
- Add: OBJLoader materials are now fixed like FBX materials
## [4.0.2-alpha] - 2024-12-12
- Add: Support for custom scripts on WebXR custom hands
- Fix: OrbitControls should not listen to window.body for key events
## [4.0.1-alpha] - 2024-12-11
- Fix: Objects spawned with `syncedInstantiate` should automatically be removed when disconnecting from the networking room
- Fix: Issue where objects rendered with instancing enabled were not visible in screenshots
## [4.0.0-alpha] - 2024-12-09
- Add: Builds can now be compressed on Needle Cloud instead of locally. Set the `NEEDLE_CLOUD_TOKEN` environment variable to your Cloud access token to enable this. This allows running compression in CI build pipelines, for example in a Github Action. Needle Cloud access tokens can be obtained on https://cloud.needle.tools/team.
- Add: `DropListener` now optionally supports networking when `allowNetworking` is on. Dropped files will be network-synced if the file size does not exceed a certain size (50 MB for projects on paid plans; 5 MB for projects free plans).
- Fix: Previously, when changing a `@syncField` property, only the last changed property was synchronized to the server. This is now fixed. Note that this is a **breaking change**: previously networked server state with the `@syncField` attribute in Needle Engine 3.x projects will not be loaded in Needle Engine 4.0.
- Change: `EventList` now takes a generic type code hints when using `myEventList.addEventListener(...)` e.g. `new EventList()`
- Change: The default networking server is now located at `networking.needle.tools`
- Change: The `DropListener` API has changed
- Change: OrbitControls `useKeys` is now false by default since the underlying three.js OrbitControls incorrectly capture ALL keyboard events on the page.
- Change: Loading speed improvements and improved Lighthouse score
- Change: md5 hashing results are now S3-compatible
## [3.51.1] - 2024-12-09
- Fix: DragControls snap to surface setting should use world normal
- Fix: Needle Menu missing focus-visible for overflow menu button
- Fix: Needle Menu :focus-visible on menu elements barely being visible
- Fix: edge case where we still showed the QR code when only the WebXR component is on and we're on mobile
- Fix: detect URL content format using "Content-Type" header as well
- Fix: double quotes in USDZ displayName need to be escaped
- Fix: don't fetch when we already know fetch won't work due to cross-origin isolation
- Change: for QuickLook, use "View in AR" instead of "Download for AR" even for cases where we're not sure if the device actually supports QuickLook – rel="ar" is not reliable
- Change: disable Needle logo being clickable during loading because users click it accidentally and then they're lost
- Docs: add @group Component to components since TypeDoc doesn't do inheritance as expected
## [3.51.0] - 2024-11-28
- Add: API docs for networking methods
- Add: USDZ export automatically creates "hold" animations now to prevent animation snapping
- Add: USDZ export now supports ShadowCatcher component and materials
- Add: USDZ export now contains more meta-info about exported animations
- Add: Log warnings on USDZ export for overlapping animation roots so hierarchy can be manually adjusted
- Add: Use ?debugusdzbehaviours to log more information and Behaviour Graphs during USDZ export. A graph in mermaid format will be logged into the console, which can be pasted into https://massive-mermaid.glitch.me or other viewers.
- Fix: USDZ animation rounding error edge cases for long-running animations (>20.000 frames)
- Fix: USDZ export only adds physics extension now if required to work around QuickLook issue (FB15925487) for animated objects with physics components
- Fix: USDZ exporter adds rest poses properly again
- Fix: Developer console is now more robust against network errors, e.g. offline PWA usage
- Fix: Canvas parent element size now matches the canvas size
## [3.50.0-beta] - 2024-10-28
- Add: PWA plugin now works with gzip compression
- Add: Asynchronous overload for `screenshot2` method that returns a `Promise`
- Add: USDZExporter supports `animator.minMaxOffsetNormalized` and `animation.minMaxOffsetNormalized` for QuickLook now
- Add: USDZExporter vertex color export. Use unlit white materials with only vertex colors to export as `displayColor` without a material. This is supported on iOS 18+ and visionOS 2+.
- Fix: automatically instanced/batched meshes are not exported twice in USDZ anymore.
- Change: "Open in QuickLook" is now "View in AR" to be more consistent
- Change: Deprecate device utilities outside the `DeviceUtilities` namespace, use the methods directly from the namespace instead (e.g. `DeviceUtilities.isSafari()`)
- Change: legacy `Object3D.transform` wrapper that returns itself
## [3.49.0-beta] - 2024-10-21
- Add: More jsdoc code API documentation
- Add: `OrbitControls` can now lerp to a target field of view
- Add: Timeline animation tracks now can have 0..1 weights
- Add: `getBoundingBox` can now optionally respect a layer mask for determining which objects to include
- Fix: Regression with animations not playing on instantiated objects
- Fix: `DeleteBox` uses `getBoundingBox` now instead of a custom implementation
- Fix: `Duplicatable` now correctly checks for its target object already being deleted
- Fix: vite plugins use vite 5.x API (and are still compatible with 4.x)
- Fix: MX Ink support for QuestOS v71+
- Fix: Some logs where incorrectly not behind debug flags
- Fix: Don't export cameras in USDZ when requesting QuickLook-compatible assets
- Fix: Exclude childs of `ContactShadows` and `GroundProjectedEnv` from USDZ export
- Fix: Custom hand models should not automatically become occluders in Passthrough XR
- Fix: Avoid potential exception in `GameObject.getAllComponents(...)`
- Fix: Prevent exception in `DragControls` when dragged object or controller disappear mid-drag
- Fix: Improve `EventList` usage from pure JS
- Fix: Regression in `OrbitControls.autoFit` that resulted in a wrong fit in some cases
- Fix: Improve order of batch validation for automatic instancing when some meshes have different attributes
- Change: Needle Menu styles are more consistent now
- Change: Change casing on `isiPad()`, deprecate `isIPad()`
## [3.48.3] - 2024-09-30
- Add: `NeedleXRSession.start("ar")` support which will start `immersive-ar` on supported devices or export an interactive USDZ on iOS devices
- Add: nextjs alias plugin
- Fix: Voip on iOS with connected bluetooth device should select the bluetooth device
## [3.48.1] - 2024-09-24
- Add: `` attributes for `background-color`, `background-blurriness` and `background-image`
- Fix: Loading of OBJ files exported from ZBrush
- Fix: Loading of FBX files with empty vertex color attributes
- Fix: Unregister mixer in Animation component
- Fix: Needle Menu CSS improvements when using custom html elements inside the menu
- Fix: Needle Menu top positioning now takes CSS safe area into account
- Fix: Balloon message styles adjusted
- Fix: ContactShadows auto fit calculation
- Change: Exit AR button style aligned with Needle Menu
## [3.48.0] - 2024-09-19
- Add: Logitech MX Ink controller support
- Add: Quest menu button now shows Needle Menu in immersive-ar and immersive-vr
- Fix: Improved USDZ code generation regarding transformations/matrices
- Fix: USDZ multi-channel attribute export
- Fix: Minor jsdoc comment error
- Fix: Postprocessing Volume `removeEffect` does now also remove effects from assigned `sharedProfile`
- Internal: Warn if Rigidbody physics object could not be created due to a missing collider
## [3.47.8] - 2024-09-10
- Fix: LookAt orientation fixed when both `copyRotation` and `keepUp` are active
- If you have both options enabled and rely on the previous behaviour, toggle `invertForward` to get the same result as before.
- Fix: USDZExporter correctly applying `arScale` again
- Fix: Issue with Needle Menu buttons preventing AR or VR to start in certain cases/devices
- Fix: BatchedMesh/Instancing error after adding/removing many instances and growing the batched mesh buffers where internal state was not properly reset causing an error
- Change: Make Needle Menu text not selectable
- Change:`NeedleXRSession.start("immersive-ar")` now exports to USDZ when called on iOS (experimental)
- Change: Needle Menu foldout is now closed when entering XR
- Change: Remove `Quit XR` button for screen based AR experiences (in favor of the X icon at the top right corner)
- Change: Needle Menu foldout button has now an larger click area to avoid accidental clicks on the Needle logo
- Change: LookAt `copyTargetRotation` is now disabled automatically during VR/passthrough AR session
## [3.47.7] - 2024-09-04
- Fix: Support loading FBX files in ASCII format
- Fix: Support loading OBJ files starting with `# Alias OBJ`
- Change: Needle Menu buttons height adjusted for mobile
## [3.47.6] - 2024-09-02
- Fix: USDZ animation interpolation. We're now using timesamples for `translation`, `orientation` and `scale` separately. This fixes an issue with animation optimization (optimization removing redundant keyframes) to just 2 keyframes where matrix timesamples would produce unexpected interpolations
- Change: inline mesh bvh worker
## [3.47.6-beta] - 2024-09-02
- Add: `Mathf.random()` can now also accept an array to randomly select an element
- Add: AudioSource `pitch` property
- Add: SpriteRenderer `addSprite` method
- Add: SpriteRenderer `texture` setter to change the texture of the currently rendered sprite
- Fix: SpriteRenderer `sprite` setter
- Fix: OrbitControls double click to focus should not focus if the click was already used (e.g. by a button)
- Fix: XR `screenshot()` support
- Fix: DragControls now work with physical objects again e.g. Rigidbodies that react to gravity
## [3.47.5-beta.1] - 2024-08-28
- Add: `screenshot` option to output a texture
- Fix: `screenshot` method when using a camera with a RenderTexture assigned
- Fix: `ObjectUtils.createPrimitive` option linting
- Change: Addressables `instantiate` method now returns Object3D type
## [3.47.5-beta] - 2024-08-27
- Fix: Shader warmup when loading glTF file containing *only* materials (no scenes)
- Fix: OrbitControls `autoTarget` option causing `setLookTargetPosition` to be overriden during the first frame
- Fix: Compressed RenderTexture not being updated on objects in the scene
- Fix: Physics mesh BVH generation on worker caused raycasts during processing to not work until the BVH was ready
## [3.47.4-beta.3] - 2024-08-26
- Fix: three.js changing environment texture while in XR
- Fix: three.js OrbitControls zoom damping
- Fix: GroundProjectedEnv error when setting `height` as part of init properties as part of `addComponent(..., { height: 4 })`
- Fix: OrbitControls `minZoom` and `maxZoom` should be applied during update
- Change: Camera `backgroundBlurriness` and `backgroundIntensity` should be undefined by default
## [3.47.4-beta.1] - 2024-08-24
- Add: Support loading of glTF files in `` that don't contain any objects/scenes but just materials. These glTF files will be rendered with a shaderball
- Fix: Regression in ParticleSystem trail rendering where `mode` was not set correctly
- Change: OrbitControls `fitCamera` can now also take a single object as a first parameter
## [3.47.4-beta] - 2024-08-17
- Add: OrbitControls `fitCamera` method overload which can directly take an options parameter. E.g. it can be invoked with `fitCamera({ immediate: false })`
- Fix: Lifecycle hooks like `onStart` and `onInitialized` are now properly called again for new subscribers
- Fix: Regression in raycasting with multi-material objects
- Fix: `` canvas highlighting with touch on iOS
- Change: The WebGL context is now automatically restored when lost
## [3.47.3-beta.2] - 2024-08-14
- Fix: Issue where automatic camera change stopped working
- Fix: `screenshot` should update the camera aspect ratio before rendering
- Fix: Physics raycasts do now run basic geometry validation
## [3.47.3-beta] - 2024-08-13
- Add: Improved ParticleSystem MinMaxCurve and MinMaxGradient types with utility methods (`constant`, `betweenTwoColors` / `setConstant`, `setMinMaxConstant`, `setCurve`)
- Add: preliminary support for MX Ink pens
- Add: NeedleXRController `pinchPosition` getter for hand tracking
- Add: SceneSwitcher add `sceneLoaded` Eventlist
- Add: DragControls static `CurrentlySelected` getter to access all currently active DragControls components
- Fix: Gizmo label offset
- Fix: XRControllerFollow on VisionOS with hand tracking
- Fix: Vision OS depth buffer workaround (FB14720123)
- Fix: emulate grip space for hands that don't have grip space
- Fix: `screenshot2` should use passed in camera
- Fix: nextjs plugin fix for error caused by mesh bvh worker integration
- Fix: `input.mouseDoubleClick` getter
- Fix: EventList invocation with custom arguments (e.g. `myEvent.invoke("test")`)
## [3.47.2-beta.3] - 2024-08-08
- Fix: Properly resolve EventList calls when using `instantiate` to the new instances
- Fix: WebXR simulator hand gesture calculation
- Fix: WebXR desktop preview with postprocessing enabled
- Fix: WebXR input `click` detection
## [3.47.2-beta.2] - 2024-08-06
- Add: Type definitions for Object3D Needle Engine extension methods like `addComponent` or `worldPosition`
- Add: ObjectUtils `createText`
- Add: static `BoxCollider.add` method
- Add: Experimental util method `PlayerSync.setupFrom` to easily setup networked player representations
- Add: ContactShadows `minSize` property
- Fix: ShadowCatcher should set `receiveShadow` to true
- Fix: Animation `play` should restart the animation if it's at the end
- Fix: ContactShadows should ignore Line materials
- Fix: SyncedRoom component is easier to setup from code
- Change: Physics collider center x should not be flipped. Instead the exporters need to ensure the correct space
## [3.47.1-beta] - 2024-08-05
- Add: Voip microphone button option to allow users to mute and unmute themselves
- Add: More jsdoc documentation
- Fix: Improved audio and voicechat streams when using the Voip component to more reliably play audio and connect to all users in the room
- Fix: Prevent browsers translation of HTML icons
- Fix: Issue with Application audio playback permissions check
- Fix: SpriteRenderer setting `renderOrder` must be rounded to an integer
## [3.47.0-beta.3] - 2024-08-01
- Add: NeedleXRController `emitPointerDown`, `emitPointerUp` and `emitPointerMove` properties to control if the controller should emit pointer events to the Needle Engine Input System
- Add: NeedleXRController `pointerMoveDistanceThreshold` and `pointerMoveAngleThreshold` for changing when controller `pointermove` events are emitted. These values can be set to 0 to emit events every frame or larger values to reduce the number of events emitted.
- Add: Support to disable SpatialGrabRaycaster by setting the static property `SpatialGrabRaycaster.allow = false`
- Fix: Vite issue where mesh bvh worker was not found in local dev server
- Fix: Mesh BVH should not raycast on meshes that don't have a position attribute
- Change: EventSystem now respects used events. This means if you subscribe to `pointerdown/pointermove/pointerup` with the queue set to a negative value and call `event.use()` or `event.preventDefault()` the EventSystem will ignore the event.
## [3.47.0-beta] - 2024-07-31
- Add: accelerated raycasting using three-mesh-bvh. All calls to `physics.raycast()` now use a spatial grid solution under the hood to improve raycasting performance. (This can be disabled in the raycasting options by setting `useAcceleratedRaycast: false`)
- Add: `physics.engine.raycast` methods now have an option to ignore the `ignoreRaycastLayer` on the Object3D (the three.js layer 2 is used to exclude objects from raycasting. This means setting `layers.set(2)` is equivalent to "Do not raycast on this object")
- Minor UI performance improvements
## [3.46.1-beta.4] - 2024-07-30
- Add: SpriteRenderer `toneMapped` option
- Fix: minor iOS color fix in Needle Menu CSS
- Change: SyncedRoom auto-generated room name is now numbers only by default
## [3.46.1-beta.3] - 2024-07-29
- Fix: Voip should stop audio sending and receiving when user disconnects from a networked room
- Fix: WebXR avatar head being offset when user is not centered in rig space
## [3.46.1-beta.2] - 2024-07-29
- Fix: WebXR teleport and rotation now takes user position in rig space into account. This means when teleporting the user is now placed at the expected ray target point and when rotating the user is rotated around himself as expected (and the position stays the same)
- Fix: Animation component `fadeDuration` didn't fade out previously playing animations but instead stop immediately
## [3.46.1-beta.1] - 2024-07-29
- WebXR performance improvements
- Add: Needle Menu foldout submenu for smaller screen sizes. The compact Needle Menu does now have a submenu which can be opened by clicking the 3 dots button at the right side. This improves the menu layout for smaller screen sizes.
- Fix: ContactShadows performance improvements
- Fix: Gizmo label performance improvements
## [3.46.1-beta] - 2024-07-26
- Add: `isMacOS` utility method
- Improve WebXR controller and hand raycasting and line rendering. Hide rays while the primary pointer i active.
- Improve DragControls performance
- Fix: Animation `play` should resume paused animations instead of restarting
- Fix: PWA plugin now automatically disables gzip compression. Improved error message if there's missing configuration
- Fix: SyncedRoom `joinRoom` button not creating a new room if the room url parameter was present but empty
- Change: Better error message for circular imports causing scripts to not work
- Change: On OSX and MacOS use power-preference `default` for improved performance ([webkit issue](https://bugs.webkit.org/show_bug.cgi?id=276959))
## [3.46.0-beta.5] - 2024-07-23
- Add: WebXR teleport using right hand pinch
- Add: WebXR `Quit XR` button
- Add: SceneSwitcher `useSceneBackground` option to apply background skybox from loaded scene (if it has any)
- Add: SceneSwitcher option to add Needle menu buttons
- Add: `Gizmos.DrawCircle`
- Fix: issue where `depth-sensing` would cause camera near and far planes to have invalid values causing the scene to not render properly anymore when exiting AR
- Fix: DropListener should not prevent propagation. Otherwise e.g. RemoteSkybox and DropListener would not work together
- Fix: DropListener `placeOnHit` should not raycast on just dropped object
- Fix: issue where onPointerEnter is only invoked once if onPointerExit isnt declared
- Fix: WebXRController hits rendering on UI elements
- Fix: WebXRController rays are always visible when enabled but with a low opacity if no object was hit
- Change: WebXR `autoPlace` does now only place on flat surfaces with a small time threshold
- Change: DragControls `SnapToSurface` now uses `DynamicViewAngle` if no object was hit
- Change: Needle Menu active and focus button CSS
## [3.46.0-beta.1] - 2024-07-23
- Add: MeshTracking (WebXRPlaneTracking) is by default now generating occluder meshes for detected planes and meshes
- Fix: Animation `playOnAwake` regression
- Fix: ContactShadows ignoring GroundProjectedEnv sphere, gizmos and depth only objects (e.g. occluder spheres from mesh tracking)
- Fix: Ensure Sprites when exporting to USDZ
- Change: Settings on WebARSessionRoot are now all moved to the WebXR component
- Update three.js dependency to 0.162.6
## [3.46.0-beta] - 2024-07-22
- WebXR performance improvements for immersive-ar sessions as well as controller and hand tracking
- Add: GroundProjection can now blend with the AR environment using the `blending` property
- Change: WebXR controller hits now only use object bounds
## [3.45.2-beta.5] - 2024-07-22
- Add: AudioSource properties for `time`, `time01` (normalized time), `duration`
- Add: Animation properties for `time` and method for `pause()`
- Add: WebXRPlaneTracking `occluder` property to automatically generate occluder meshes for detected meshes
- Change: Hide GroundProjection in immersive-ar
- Update three.js dependency to 0.162.5
## [3.45.2-beta.4] - 2024-07-19
- Fix: DragControls `Snap To Surface` when starting to drag
- Change: Minimal increase of close distance for SpatialGrab in WebXR
## [3.45.2-beta.3] - 2024-07-18
- Add: Support for immersive-ar `unbounded` session for unlimited passthrough experiences (enabled by default).
This is currently an experimental feature in the Quest browser. To enable it go to `chrome://flags` and check `WebXR experiments`, then restart the Browser. The next time you start an immersive-ar session on quest the WebXR experience will run without guardian boundaries.
- Add: NEPointerEvent `isSpatial` getter to easily determine if an input event was generated by a spatial device
- Fix: Raycast handle null or empty objects in targets array
## [3.45.2-beta.1] - 2024-07-17
- Add: Object `static:true` does now disable `matrixAutoUpdate`
- Fix: Animation component `play()` issue where previous animations were not always stopped/faded out
- Fix: SceneSwitcher regression causing scenes to not be unloaded
- Change: pointer events are now captured and continue to work when they hover over other HTML elements (if started in the 3D scene)
## [3.45.1-beta.7] - 2024-07-16
- Add: vite plugin that ensures that the npm folder exists
- Fix: Issue where completely empty scene without explicit XR rig caused invalid placement/rendering in VR
- Change: Disable touch-action on `` element
## [3.45.1-beta.5] - 2024-07-16
- Update gltf-progressive to version 1.2.5
## [3.45.1-beta.3] - 2024-07-15
- Add: GroundProjection blurriness set from `scene.backgroundBlurriness`
- Fix: `getTempVector` and `getTempQuaternion` set to 0,0,0 by default to return consistent values when called without parameters
## [3.45.1-beta.1] - 2024-07-13
- Add: GroundProjection `autoFit` option
- Fix: OrbitControls re-applying autoFit again when enabled/disabled
- Fix: `getBoundingBox` should ignore gizmos
## [3.45.1-beta] - 2024-07-12
- Add: Camera `backgroundRotation` property
- Add: GroundProjection environment rotation using `scene.backgroundRotation`
- Fix: XRControllerModel `createHandModels` not working when `createControllerModels` was disabled
- Change: WebXR avatar does now hide local hand models when XRControllerModel models or hands are enabled
## [3.45.0-beta.1] - 2024-07-11
- Add: The WebXR component now uses a static avatar from the CDN if none is assigned
## [3.45.0-beta] - 2024-07-11
- Add: XRControllerFollow does now reset the object to the original pose after XR
- Fix: XRControllerFollow does now take original object scale into account
- Fix: OrbitControls autoFit now takes GroundProjection scale into account for the camera far plane
- Change: ContactShadows do now apply scale and transform to a child object so it does not modify the transform anymore of the object it was added to
- Change: GroundProjectionEnv default height to 3
- change: Increase GroundProjectionEnv resolution to 128 for smoother edges
- Change: ChangeMaterialOnClick does now change mouse cursor on hover
## [3.44.6] - 2024-07-10
- Add: The default XR rig is now automatically placed to view the scene if no explicit XRRig component is found in the scene
- Add: XRControllerMovement does now allow teleportation on the current rig ground plane (if no object is hit when trying to teleport)
- Fix: XRController ray rendering should respect rig scale if the ray doesnt hit any object in the scene
- Fix: rare issue in input calculating world position from screenspace input
- Change: Voip component `autoConnect` default changed to true
## [3.44.5] - 2024-07-10
- Add: `window[Needle].NeedleXRSession`
- Change: WebARSessionRoot reticle without depth test for better use with depth sensing
- Change: VR default movement speed increased slightly from 1 to 1.5
- Change: VR default hit visualization adjusted to improve raycasting.
## [3.44.4] - 2024-07-09
- Fix: SceneSwitcher can now activate and deactivate objects in the scene
- Fix: `XRControllerFollow` takes rig scale into account
- Change: WebXR controllers do not raycast the scene for hit visualization anymore by default. To use add `XRControllerMovement` and enable `showHits`
## [3.44.3] - 2024-07-05
- Add: TonemappingEffect `exposure` setting to control tonemapping exposure
- Fix: Animator transition for negative timescale
## [3.44.1] - 2024-07-05
- Add: `instantiate` can now be invoked to clone objects without components
- Fix: OrbitControls `autoTarget` and `autoFit` at the start of a scene
- Fix: KTX2Loader being created both by needle engine and gltf-progressive resulting in a warning
- Change: DragControls `SnapToSurface` is more snappy
- Change: DragControls `SnapToSurface` drag start behaviour improved
## [3.44.0] - 2024-07-04
- Add: `syncInstantiate(object, { deleteOnDisconnect:boolean })` and `IModel { deleteOnDisconnect:boolean }` option to delete a networked instance in the networking storage when a user disconnects. This requires the networking server to use `@needle-tools/networking@2.x` (instead of `@needle-tools/needle-tiny-networking-ws`)
- Fix: Improve `PlayerSync` networking, use `deleteOnDisconnect`
- Fix: Update draco decoader to 1.5.7
- Fix: SharpeningEffect effect order
- Fix: SharpeningEffect alpha handling
- Fix: WebXR MeshTracking plane and mesh normals
- Fix: ChangeMaterialOnClick resolving of assigned material in certain cases
- Fix: Duplicatable + DragControls not properly networking on first duplication in cases where multiple DragControls components are nested
## [3.44.0-beta.2] - 2024-07-02
- Add: Expose `AnimationUtils`
- Fix: Dont apply reflection probes to unlit materials
- Fix: FBX loading can now handle multimaterial objects
- Fix: WebXR networked Avatar head position
- Fix: Needle Menu layout update is now enforced immediately when options change
- Fix: Initialize Postprocessing effects parameter when created from code
## [3.44.0-beta.1] - 2024-07-01
- Add: support to use file extension for determining which loader to use to save initial header fetch
- Add: Tuned AGX tonemapping
- Fix: Sharpening effect causing color overflow
- Fix: `screenshot()` breaking transparent rendering
## [3.43.0-beta.1] - 2024-06-29
- Add: `environment-image` magic names now use a lower-resolution version of the HDR/EXR image if the texture is just used for lighting
- Fix: Toggle Volume component `enable` should add and remove the effects
- Fix: Remove leftover log in ``
## [3.43.0-beta] - 2024-06-28
- Add: Postprocessing Sharpening effect
- Add: PostprocessingManager `addEffect` and `removeEffect` API
- Fix: Error in spatial menu caused by slots
- Fix: Export of WebXRButtonFactory type
## [3.42.0-beta] - 2024-06-27
- Add: `` slot support
- Add: `` with support for `ar`, `vr` and `quicklook`. For example: `` creates a Needle VR button
- Change: default tonemapping is now tuned AGX
## [3.41.2-beta.3] - 2024-06-27
- Add: support to use file extension for determining which loader to use to save initial header fetch
- Fix: Patched neutral tonemapping [issue](https://github.com/google/model-viewer/issues/4825)
## [3.41.2-beta] - 2024-06-25
- Add: DropListener can now take `dropArea` object to define a section of the scene that would accept the dropped file.
- Add: DropListener support to fit a mesh into a defined volume (e.g. 1x1x1)
- Add: SyncedRoom option to create a share button for the view only room URL
- Fix: DragControls `SnapToSurface` option when dragged object is not a mesh / the mesh is in the child hierarchy
## [3.41.1-alpha.1] - 2024-06-24
- Add: `` attribute. Possible values are `none`, `linear`, `neutral` or `agx`.
- Change: Camera fitting near and far planes are now tighter to reduce z-fighting in some cases
## [3.41.0-alpha.5] - 2024-06-22
- Add: `` web component attributes `environment-image` and `skybox-image` can now be set to presets values: "studio", "blurred-skybox", "quicklook" or "quicklook-ar"
- Fix: ContactShadows should capture objects on all layers
- Fix: Issue in LOD gizmo debug rendering
- Change: Use smaller icons font
## [3.41.0-alpha.4] - 2024-06-19
- Add: AnimationRegistry, accessible via `this.context.animations`
- Add: static AnimationUtils class
- Add: `TestSceneUtils.createComparisonScene` for quickly spinning up test scenes
- Add: Menu `appendChild` can now create a button from a structured json object
- Add: New `exportAsGLTF` function
- Add: `` attribute
- Add: Lifecycle hooks like `onStart` or `onUpdate` can now be configured to only run once using the options argument. For example: `onBeforeRender(ctx => { ... }, { once: true })`
- Fix: Postprocessing where Tonemapping was not being applied in some cases
- Fix: `screenshot` method does now support Reflection Probe lighting
- Fix: Lightmapped objects with MultiMaterial objects spamming warnings
- Change: Improve Postprocessing Bloom
- Change: Improve FBX loading
- Change: ContactShadows `autoFit` increases shadow area by factor 1 (previously 0.5)
- Change: Bump three to 0.162.4 adding GLTFExporter plugin hooks and animation retargeting using `userData { name }`
- Change: Bump postprocessing to ^6.35.5
- Change: Bump gltf-progressive dependency
## [3.40.0-alpha.5] - 2024-06-14
- Add: start support for detecting and loading FBX files
- Fix: Camera fitting bounding box calculation where `instanceof Mesh` fails
- Fix: OrbitControls background click only accept primary clicks
- Fix: Issue on Quest due to change in `isMobile` check
- Internal: Deserialization of components can now resolve object if the requested type is an Object3D
## [3.40.0-alpha.2] - 2024-06-12
- Add: Experimental support to load `.fbx` files via ``
- Change: Production build command changed - vite plugin now runs when `vite build` is invoked with `--production` - e.g. `vite build -- --production`. The legacy npm build script is automatically updated when the plugin runs for the first time.
## [3.40.0-alpha.1] - 2024-06-10
- Fix: issue where `` would not play animations
- Change: "IsMobile" check because window.orientation is deprecated
- Change: USDZ move direct/indirect interaction logic to tapTrigger and add options (by default, both are allowed)
## [3.40.0-alpha] - 2024-06-06
- Update gltf-progressive dependency for smarter LOD texture loading
## [3.39.0-alpha.4] - 2024-06-04
- Add: `WebARSessionRoot.onPlaced` event hook
- Fix: InputField click should open keyboard on Android and iOS
- Fix: ContactShadow and ShadowCatcher meshes should not be raycastable
- Change: OrbitControls `fitCamera` use options object, add "centerCamera" option
## [3.39.0-alpha.3] - 2024-06-04
- Fix: Mesh particle LODs not being loaded
- Fix: UI Image/Raw Image texture LODs not being updated
## [3.39.0-alpha.2] - 2024-06-03
- Fix: vite build pipeline plugin
## [3.39.0-alpha] - 2024-06-03
- Fix: Issue where OrbitControls setTarget not working as expected sometimes due to first frame matrices not being updated yet
- Fix: Gizmos sometimes rendering for 2 frames instead of just 1
- Change: WebXRImageTracking now applies some smoothing based on jitter amount
- Change: Bump gltf-build-pipeline package to 2.1
## [3.38.0-alpha.3] - 2024-05-30
- Fix: needle menu CSS blur in safari
- Fix: USDZ - move Animation component animations into correct sequence depending on whether it should loop or not
- Fix: QuickLook button being created by WebXR despite `usdzExporter.allowCreateQuicklookButton` explicitly being off
## [3.38.0-alpha.2] - 2024-05-29
- Fix: Issue in vite plugin for Node 16 where fetch wasn't supported yet
- Fix: AudioListener should remove itself when disabled
## [3.38.0-alpha.1] - 2024-05-29
- Add: OrbitCon...