sceneview-mcp 4.1.2 → 4.3.0

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.
@@ -4,12 +4,12 @@
4
4
  // build time so the MCP server, telemetry, and the install-snippet
5
5
  // generators all report the actually-published versions instead of
6
6
  // stale hardcoded constants. See #941.
7
- export const PACKAGE_VERSION = "4.1.2";
8
- export const LATEST_SCENEVIEW_RELEASE = "4.53.0";
7
+ export const PACKAGE_VERSION = "4.3.0";
8
+ export const LATEST_SCENEVIEW_RELEASE = "4.72.0";
9
9
  // The pub.dev coordinate for `flutter_sceneview`, read from the plugin's
10
10
  // README. Deliberately NOT LATEST_SCENEVIEW_RELEASE: pub.dev lags the SDK,
11
11
  // and a caret range against an unpublished version cannot be resolved.
12
- export const LATEST_FLUTTER_PUB_RELEASE = "4.39.0";
12
+ export const LATEST_FLUTTER_PUB_RELEASE = "4.68.0";
13
13
  // Web Filament runtimes, from ../gradle/libs.versions.toml (#3173).
14
14
  // FILAMENT_WEB_NPM_VERSION is the npm `filament` pin (CDN artifacts, Kotlin/JS);
15
15
  // FILAMENT_WEBSITE_VERSION is the runtime vendored for sceneview.js.
@@ -17,5 +17,5 @@ export const FILAMENT_WEB_NPM_VERSION = "1.52.3";
17
17
  export const FILAMENT_WEBSITE_VERSION = "1.72.1";
18
18
  // SceneViewSwift node types: every `public struct *Node` under
19
19
  // SceneViewSwift/Sources (#2999). Enum namespaces are not nodes.
20
- export const IOS_NODE_TYPES = ["AnchorNode", "AugmentedImageNode", "BillboardNode", "CameraNode", "DynamicSkyNode", "FogNode", "GeometryNode", "ImageNode", "LightNode", "LineNode", "MeshNode", "ModelNode", "PathNode", "PhysicsNode", "ReflectionProbeNode", "ShapeNode", "SpatialAudioNode", "TextNode", "VideoNode", "ViewNode"];
21
- export const IOS_NODE_TYPE_COUNT = 20;
20
+ export const IOS_NODE_TYPES = ["AnchorNode", "AugmentedImageNode", "BillboardNode", "CameraNode", "ContactShadowNode", "DynamicSkyNode", "FogNode", "GeometryNode", "ImageNode", "LightNode", "LineNode", "MeshNode", "ModelNode", "PathNode", "PhysicsNode", "ReflectionProbeNode", "ShapeNode", "SpatialAudioNode", "TextNode", "TubeNode", "VideoNode", "ViewNode"];
21
+ export const IOS_NODE_TYPE_COUNT = 22;
package/dist/guides.js CHANGED
@@ -13,9 +13,11 @@ export const PLATFORM_ROADMAP = `# SceneView Multi-Platform Roadmap
13
13
  |----------|--------|----------|----------|
14
14
  | **Android (Compose)** | Stable | \`io.github.sceneview:sceneview:${LATEST_SCENEVIEW_RELEASE}\` | Filament |
15
15
  | **Android (AR)** | Stable | \`io.github.sceneview:arsceneview:${LATEST_SCENEVIEW_RELEASE}\` | Filament + ARCore |
16
- | **iOS (SwiftUI)** | Alpha | SceneViewSwift SPM \`from: "${LATEST_SCENEVIEW_RELEASE}"\` | RealityKit + ARKit |
17
- | **macOS (SwiftUI)** | Alpha | SceneViewSwift SPM (in Package.swift) | RealityKit |
18
- | **visionOS (SwiftUI)** | Alpha | SceneViewSwift SPM (in Package.swift) | RealityKit |
16
+ | **iOS (SwiftUI)** | End of life at 4.68.0 | SceneViewSwift SPM \`exact: "4.68.0"\` | RealityKit + ARKit |
17
+ | **macOS (SwiftUI)** | End of life at 4.68.0 | SceneViewSwift SPM (in Package.swift) | RealityKit |
18
+ | **visionOS (SwiftUI)** | End of life at 4.68.0 | SceneViewSwift SPM (in Package.swift) | RealityKit |
19
+ | **Flutter** | End of life at 4.68.0 | \`flutter_sceneview\` | Filament / RealityKit |
20
+ | **React Native** | End of life at 4.68.0 | \`@sceneview-sdk/react-native\` | Filament / RealityKit |
19
21
  | **KMP Core** | Stable | \`io.github.sceneview:sceneview-core:${LATEST_SCENEVIEW_RELEASE}\` | N/A (shared logic) |
20
22
 
21
23
  ## Architecture: Native Renderers per Platform
@@ -35,7 +37,9 @@ KMP shares **logic**, not **rendering**. Each platform uses its native renderer.
35
37
  - **Compose-native DSL**: all nodes are \`@Composable\` functions inside \`SceneView { }\` or \`ARSceneView { }\`.
36
38
  - **48+ node types**: ModelNode, LightNode, AnchorNode, CameraNode, TextNode, PathNode, ViewNode, PlaneNode, SphereNode, CylinderNode, CubeNode, DynamicSkyNode, FogNode, ReflectionProbeNode, PhysicsNode, BillboardNode, LineNode, and more.
37
39
 
38
- ## Apple — Alpha (SceneViewSwift)
40
+ ## Apple — End of life at 4.68.0 (SceneViewSwift)
41
+
42
+ No new releases. These examples are retained for existing users.
39
43
 
40
44
  - **3D + AR** in SwiftUI via RealityKit — iOS 18+ / macOS 15+ / visionOS 2+
41
45
  - Node types: ModelNode, AnchorNode, GeometryNode, LightNode, CameraNode, ImageNode, VideoNode, PhysicsNode, AugmentedImageNode
@@ -55,9 +59,8 @@ Shared Kotlin Multiplatform module providing:
55
59
 
56
60
  ## Upcoming
57
61
 
58
- - **SceneViewSwift stabilization** — API parity with the Android core nodes, KMP core consumed as an XCFramework
59
- - **Android XR and visionOS spatial computing**
60
- - **Cross-framework bridges** — Flutter and React Native over the same native cores
62
+ - **Android XR spatial computing**
63
+ - **Web and Compose Multiplatform desktop** — continued development of maintained Alpha targets
61
64
 
62
65
  These are not tied to a version number: \`4\` is the current major line, and \`5.0.0\` is a
63
66
  deliberate milestone rather than an automatic bump.
@@ -199,7 +202,7 @@ viewModelScope.launch(Dispatchers.IO) {
199
202
 
200
203
  ### ARCore Threading
201
204
  - \`Session.update()\` must run on the main thread (SceneView handles this via \`onSessionUpdated\`).
202
- - \`hitResult.createAnchor()\` is safe on the main thread (called from \`onTouchEvent\` which runs on main).
205
+ - \`createAnchorOrNull()\` on an ARCore hit from \`frame.hitTest(event)\` is safe on the main thread (gesture callbacks such as \`onSingleTapConfirmed\` run on main).
203
206
  - Cloud anchor hosting/resolving is async — SceneView's \`CloudAnchorNode\` handles the callbacks correctly.
204
207
  `;
205
208
  export const BEST_PRACTICES = {
@@ -234,7 +237,7 @@ export const TROUBLESHOOTING_GUIDE = `# SceneView Troubleshooting Guide
234
237
  1. \`rememberModelInstance\` returns null while loading — are you null-checking it?
235
238
  2. Is the model path correct? Assets go in \`src/main/assets/models/\`
236
239
  3. Is \`scaleToUnits\` too small or too large? Try \`1.0f\`
237
- 4. Is there a light in the scene? Add a directional light: \`LightNode(apply = { intensity(100_000.0f); direction(0f, -1f, 0f) })\`
240
+ 4. Is there a light in the scene? Add a directional light: \`LightNode(type = LightManager.Type.DIRECTIONAL, apply = { intensity(100_000.0f); direction(0f, -1f, 0f) })\`
238
241
  5. Is the camera pointing at the model? Default camera is at origin looking -Z
239
242
 
240
243
  ### AR Camera Feed Shows but No Planes Detected
@@ -246,7 +249,7 @@ export const TROUBLESHOOTING_GUIDE = `# SceneView Troubleshooting Guide
246
249
 
247
250
  ### "ARCore not installed" on Device
248
251
  **Fix:**
249
- - Ensure \`<meta-data android:name="com.google.ar.core" android:value="required" />\` is in manifest
252
+ - Ensure \`<meta-data android:name="com.google.ar.core" android:value="required" tools:replace="android:value" />\` is in manifest (with \`xmlns:tools\` on \`<manifest>\`: arsceneview declares "optional", so the merge fails without the override)
250
253
  - Install Google Play Services for AR from Play Store
251
254
  - Some emulators don't support ARCore — test on a real device
252
255
 
@@ -268,7 +271,7 @@ export const TROUBLESHOOTING_GUIDE = `# SceneView Troubleshooting Guide
268
271
  - Reduce model polygon count (< 100K triangles)
269
272
  - Use KTX2 compressed textures (1024x1024 max)
270
273
  - Avoid per-frame allocations in \`onFrame\` callbacks
271
- - Disable post-processing if not needed: \`SceneView(postProcessing = false)\`
274
+ - Lighten or disable post-processing if not needed: \`SceneView(renderQuality = RenderQuality.Performance)\`, or \`view.isPostProcessingEnabled = false\` on the Filament \`View\`
272
275
  - Profile with Android GPU Inspector
273
276
 
274
277
  ### High Memory Usage
@@ -343,7 +346,7 @@ export const AR_SETUP_GUIDE = `# SceneView AR — Complete Setup Guide (Android
343
346
  ## 1. SPM Dependency
344
347
 
345
348
  \`\`\`swift
346
- .package(url: "https://github.com/sceneview/sceneview", from: "${LATEST_SCENEVIEW_RELEASE}")
349
+ .package(url: "https://github.com/sceneview/sceneview", exact: "4.68.0")
347
350
  \`\`\`
348
351
 
349
352
  ## 2. Info.plist — Camera Permission
@@ -457,7 +460,8 @@ dependencies {
457
460
  <!-- Required: tells Play Store this app needs ARCore -->
458
461
  <!-- Use "required" to block installs on non-AR devices -->
459
462
  <!-- Use "optional" to allow install but degrade gracefully -->
460
- <meta-data android:name="com.google.ar.core" android:value="required" />
463
+ <!-- arsceneview declares "optional": overriding it needs xmlns:tools="http://schemas.android.com/tools" on <manifest> -->
464
+ <meta-data android:name="com.google.ar.core" android:value="required" tools:replace="android:value" />
461
465
 
462
466
  <!-- Required ONLY for Cloud Anchors / Geospatial / Streetscape.
463
467
  Inject via manifestPlaceholders in app/build.gradle (read from
@@ -561,18 +565,34 @@ ARSceneView(
561
565
 
562
566
  ### Tap-to-Place with Anchor
563
567
  \`\`\`kotlin
568
+ import com.google.ar.core.Anchor
569
+ import com.google.ar.core.Frame
570
+ import com.google.ar.core.Plane
571
+ import io.github.sceneview.ar.arcore.createAnchorOrNull
572
+ import io.github.sceneview.rememberOnGestureListener
573
+ // …plus androidx.compose.runtime.* and the io.github.sceneview entry points (ARSceneView, rememberEngine, …)
574
+
564
575
  var anchor by remember { mutableStateOf<Anchor?>(null) }
576
+ var latestFrame by remember { mutableStateOf<Frame?>(null) }
565
577
 
566
578
  ARSceneView(
567
579
  engine = engine,
568
580
  modelLoader = modelLoader,
569
581
  planeRenderer = true,
570
- onTouchEvent = { event, hitResult ->
571
- if (event.action == MotionEvent.ACTION_UP && hitResult != null) {
572
- anchor = hitResult.createAnchor()
582
+ onSessionUpdated = { _, frame -> latestFrame = frame },
583
+ // A confirmed single tap, never a raw ACTION_UP: the end of a drag or a pinch on the
584
+ // placed model must not move it. Leaving onTouchEvent unset keeps the model's gestures.
585
+ onGestureListener = rememberOnGestureListener(
586
+ onSingleTapConfirmed = { event, node ->
587
+ if (node == null) { // empty space, not the placed model
588
+ latestFrame?.hitTest(event)
589
+ ?.firstOrNull { (it.trackable as? Plane)?.isPoseInPolygon(it.hitPose) == true }
590
+ ?.createAnchorOrNull()
591
+ // Replacing the state key disposes the old AnchorNode, which detaches its anchor.
592
+ ?.let { anchor = it }
593
+ }
573
594
  }
574
- true
575
- }
595
+ )
576
596
  ) {
577
597
  anchor?.let { a ->
578
598
  AnchorNode(anchor = a) {
package/dist/http.js CHANGED
@@ -40,7 +40,7 @@
40
40
  *
41
41
  * Configuration (environment): PORT (default 3333), HOST (default
42
42
  * 127.0.0.1 — bind 0.0.0.0 explicitly to expose it), and the same
43
- * SCENEVIEW_TELEMETRY / SKETCHFAB_API_KEY / TRIPO_API_KEY knobs as stdio.
43
+ * SCENEVIEW_TELEMETRY / SKETCHFAB_API_KEY / TRIPO_API_KEY / RUNWARE_API_KEY knobs as stdio.
44
44
  */
45
45
  import { createServer as createNodeServer, } from "node:http";
46
46
  import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
package/dist/issues.js CHANGED
@@ -61,7 +61,7 @@ export const COMMON_ISSUES = [
61
61
  title: "AR objects drift / slide when moving phone",
62
62
  symptom: "Objects placed in AR slowly drift or jump to different positions as the user walks around.",
63
63
  cause: "Using `node.worldPosition = ...` instead of `AnchorNode`. ARCore remaps its coordinate system during tracking, and plain nodes don't compensate.",
64
- solution: "Always use `AnchorNode(anchor = hitResult.createAnchor())` to place AR objects. Anchors automatically compensate for coordinate system changes.",
64
+ solution: "Always place AR objects under `AnchorNode(anchor = anchor)`, with `anchor` from `createAnchorOrNull()` on an in-polygon ARCore plane hit (`latestFrame?.hitTest(event)` in `onSingleTapConfirmed`). Anchors automatically compensate for coordinate system changes.",
65
65
  category: "ar",
66
66
  },
67
67
  {
@@ -42,7 +42,7 @@ const MIGRATION_RULES = [
42
42
  id: "replace-placement-node",
43
43
  pattern: /\bPlacementNode\b/g,
44
44
  replacement: "/* PlacementNode removed — use AnchorNode + HitResultNode */",
45
- explanation: "`PlacementNode` removed. Use `AnchorNode(anchor = hitResult.createAnchor())` + `HitResultNode`.",
45
+ explanation: "`PlacementNode` removed. Use `HitResultNode` for the cursor and `AnchorNode(anchor = anchor)` for the placed model, with `anchor` created by `latestFrame?.hitTest(event)?.firstOrNull { … }?.createAnchorOrNull()` in `rememberOnGestureListener(onSingleTapConfirmed = { event, node -> if (node == null) … })`.",
46
46
  },
47
47
  {
48
48
  id: "replace-view-renderable",
@@ -95,8 +95,8 @@ const MIGRATION_RULES = [
95
95
  {
96
96
  id: "replace-worldPosition-ar",
97
97
  pattern: /(\w+)\.worldPosition\s*=\s*(.+)/g,
98
- replacement: "// $1.worldPosition = $2 ← replaced by AnchorNode(anchor = hitResult.createAnchor()) in 3.0",
99
- explanation: "Manual `worldPosition` in AR causes drift. Use `AnchorNode(anchor = hitResult.createAnchor())` instead.",
98
+ replacement: "// $1.worldPosition = $2 ← replaced by AnchorNode(anchor = anchor) in 3.0 (anchor from an ARCore plane hit's createAnchorOrNull())",
99
+ explanation: "Manual `worldPosition` in AR causes drift. Use `AnchorNode(anchor = anchor)` instead, with `anchor` from `createAnchorOrNull()` on an in-polygon ARCore plane hit (`latestFrame?.hitTest(event)`).",
100
100
  },
101
101
  // ── Camera manipulator ─────────────────────────────────────────────────
102
102
  {
@@ -147,12 +147,12 @@ const MIGRATION_RULES = [
147
147
  replacement: "/* ArFragment removed — use ARSceneView composable in Jetpack Compose */",
148
148
  explanation: "`ArFragment` (Android View-based) removed. Use `ARSceneView(...)` composable in Jetpack Compose.",
149
149
  },
150
- // ── onTapArPlane → onTouchEvent ─────────────────────────────────────
150
+ // ── onTapArPlane → onSingleTapConfirmed ────────────────────────────
151
151
  {
152
152
  id: "replace-onTapArPlane",
153
153
  pattern: /\.onTapArPlane\s*\{/g,
154
- replacement: "// .onTapArPlane removed — use ARSceneView(onTouchEvent = { hitResult, motionEvent ->",
155
- explanation: "`.onTapArPlane` removed. Use `ARSceneView(onTouchEvent = { hitResult, motionEvent -> ... })` and call `hitResult.createAnchor()` yourself.",
154
+ replacement: "// .onTapArPlane removed — use ARSceneView(onSessionUpdated = { _, frame -> latestFrame = frame }, onGestureListener = rememberOnGestureListener(onSingleTapConfirmed = { motionEvent, node -> if (node == null) latestFrame?.hitTest(motionEvent)?.firstOrNull { (it.trackable as? Plane)?.isPoseInPolygon(it.hitPose) == true }?.createAnchorOrNull()?.let { anchor = it } }))",
155
+ explanation: "`.onTapArPlane` removed. Keep the latest `Frame` from `onSessionUpdated`, then in `ARSceneView(onGestureListener = rememberOnGestureListener(onSingleTapConfirmed = { motionEvent, node -> if (node == null) ... }))` call `latestFrame?.hitTest(motionEvent)?.firstOrNull { (it.trackable as? Plane)?.isPoseInPolygon(it.hitPose) == true }?.createAnchorOrNull()`. Never place on a raw `ACTION_UP` in `onTouchEvent`: it also fires when a drag or a pinch ends. Imports: `com.google.ar.core.Plane`, `io.github.sceneview.ar.arcore.createAnchorOrNull`, `io.github.sceneview.rememberOnGestureListener`.",
156
156
  },
157
157
  ];
158
158
  export function migrateCode(code) {
@@ -222,7 +222,7 @@ export function migrateCode(code) {
222
222
  warnings.push("`.setParent()` removed in 3.0. Declare child nodes as composables inside the parent's content block instead.");
223
223
  }
224
224
  if (code.includes("onTapArPlane")) {
225
- warnings.push("`onTapArPlane` callback removed. In 3.0, use `onTouchEvent` on `ARScene` and call `hitResult.createAnchor()` yourself.");
225
+ warnings.push("`onTapArPlane` callback removed. In 3.0, use `onGestureListener = rememberOnGestureListener(onSingleTapConfirmed = { motionEvent, node -> if (node == null) … })` on `ARSceneView`, hit-test the latest ARCore `Frame` (`frame.hitTest(motionEvent)`), then `createAnchorOrNull()` on the in-polygon plane hit.");
226
226
  }
227
227
  return {
228
228
  originalCode: code,
package/dist/migration.js CHANGED
@@ -103,9 +103,9 @@ SceneView(engine = engine, modelLoader = modelLoader) {
103
103
  | 2.x | 3.0 replacement |
104
104
  |-----|-----------------|
105
105
  | \`TransformableNode\` | Set \`isEditable = true\` on \`ModelNode\` |
106
- | \`PlacementNode\` | \`AnchorNode(anchor = hitResult.createAnchor())\` + \`HitResultNode\` |
106
+ | \`PlacementNode\` | \`HitResultNode\` cursor + \`AnchorNode(anchor = anchor)\` (anchor from \`createAnchorOrNull()\` on a tapped plane hit) |
107
107
  | \`ViewRenderable\` | \`ViewNode\` with a \`@Composable\` content lambda |
108
- | \`AnchorNode()\` (no-arg) | \`AnchorNode(anchor = hitResult.createAnchor())\` |
108
+ | \`AnchorNode()\` (no-arg) | \`AnchorNode(anchor = anchor)\` (anchor from \`createAnchorOrNull()\` on a tapped plane hit) |
109
109
 
110
110
  **TransformableNode:**
111
111
  \`\`\`kotlin
@@ -206,7 +206,7 @@ ARSceneView(
206
206
 
207
207
  | 2.x pattern | 3.0 |
208
208
  |-------------|-----|
209
- | \`node.worldPosition = hitResult.hitPose.position\` | \`AnchorNode(anchor = hitResult.createAnchor())\` |
209
+ | \`node.worldPosition = hitResult.hitPose.position\` | \`AnchorNode(anchor = anchor)\`, \`anchor = hitResult.createAnchorOrNull()\` |
210
210
 
211
211
  Plain nodes whose \`worldPosition\` is set manually will drift when ARCore remaps its coordinate system. \`AnchorNode\` compensates automatically.
212
212
 
@@ -243,11 +243,11 @@ SceneView(
243
243
  - [ ] Replace \`TransformableNode\` → \`isEditable = true\`
244
244
  - [ ] Replace \`PlacementNode\` → \`AnchorNode\` + \`HitResultNode\`
245
245
  - [ ] Replace \`ViewRenderable\` → \`ViewNode\` with Compose lambda
246
- - [ ] Fix \`LightNode { … }\` → \`LightNode(apply = { … })\`
246
+ - [ ] Fix \`LightNode { … }\` → \`LightNode(type = LightManager.Type.POINT, apply = { … })\` (\`type\` is required)
247
247
  - [ ] Remove manual \`engine.destroy()\` calls
248
248
  - [ ] Replace manual \`worldPosition\` in AR → \`AnchorNode\`
249
249
  - [ ] Replace \`ArFragment\` → \`ARSceneView()\` composable
250
- - [ ] Replace \`onTapArPlane\` → \`onTouchEvent\`
250
+ - [ ] Replace \`onTapArPlane\` → \`rememberOnGestureListener(onSingleTapConfirmed = { event, node -> if (node == null) … })\` + \`latestFrame?.hitTest(event)\`
251
251
  - [ ] Replace \`setRenderable\` → \`ModelNode(modelInstance = ...)\`
252
252
  - [ ] Replace \`setParent\` → nest composable nodes inside parent
253
253
  - [ ] Move all Filament calls to main thread (no Dispatchers.IO)
@@ -275,7 +275,7 @@ SceneView(
275
275
  | 2.x | 3.0 |
276
276
  |-----|-----|
277
277
  | \`ArFragment\` in XML layout | \`ARSceneView()\` composable |
278
- | \`arFragment.setOnTapArPlaneListener\` | \`ARSceneView(onTouchEvent = { … })\` |
278
+ | \`arFragment.setOnTapArPlaneListener\` | \`ARSceneView(onGestureListener = rememberOnGestureListener(onSingleTapConfirmed = { event, node -> … }))\` |
279
279
  | \`arFragment.arSceneView\` | Direct access via composable params |
280
280
 
281
281
  ---
@@ -107,7 +107,8 @@ dependencies {
107
107
  <uses-feature android:name="android.hardware.camera.ar" android:required="true" />
108
108
 
109
109
  <application>
110
- <meta-data android:name="com.google.ar.core" android:value="required" />
110
+ <!-- arsceneview declares "optional": overriding it needs xmlns:tools="http://schemas.android.com/tools" on <manifest> -->
111
+ <meta-data android:name="com.google.ar.core" android:value="required" tools:replace="android:value" />
111
112
  </application>
112
113
  \`\`\`
113
114
 
@@ -126,11 +127,20 @@ LaunchedEffect(Unit) {
126
127
  ### 4. Basic AR Scene
127
128
 
128
129
  \`\`\`kotlin
130
+ import com.google.ar.core.Anchor
131
+ import com.google.ar.core.Config
132
+ import com.google.ar.core.Frame
133
+ import com.google.ar.core.Plane
134
+ import io.github.sceneview.ar.arcore.createAnchorOrNull
135
+ import io.github.sceneview.rememberOnGestureListener
136
+ // …plus androidx.compose.runtime.* and the io.github.sceneview entry points (ARSceneView, rememberEngine, …)
137
+
129
138
  @Composable
130
139
  fun MyARScreen() {
131
140
  val engine = rememberEngine()
132
141
  val modelLoader = rememberModelLoader(engine)
133
142
  var anchor by remember { mutableStateOf<Anchor?>(null) }
143
+ var latestFrame by remember { mutableStateOf<Frame?>(null) }
134
144
 
135
145
  val modelInstance = rememberModelInstance(modelLoader, "models/robot.glb")
136
146
 
@@ -146,12 +156,20 @@ fun MyARScreen() {
146
156
  config.lightEstimationMode = Config.LightEstimationMode.ENVIRONMENTAL_HDR
147
157
  config.planeFindingMode = Config.PlaneFindingMode.HORIZONTAL_AND_VERTICAL
148
158
  },
149
- onTouchEvent = { event, hitResult ->
150
- if (event.action == MotionEvent.ACTION_UP && hitResult != null) {
151
- anchor = hitResult.createAnchor()
159
+ onSessionUpdated = { _, frame -> latestFrame = frame },
160
+ // A confirmed single tap, never a raw ACTION_UP: the end of a drag or a pinch on the
161
+ // placed model must not move it. Leaving onTouchEvent unset keeps the model's gestures.
162
+ onGestureListener = rememberOnGestureListener(
163
+ onSingleTapConfirmed = { event, node ->
164
+ if (node == null) { // empty space, not the placed model
165
+ latestFrame?.hitTest(event)
166
+ ?.firstOrNull { (it.trackable as? Plane)?.isPoseInPolygon(it.hitPose) == true }
167
+ ?.createAnchorOrNull()
168
+ // Replacing the state key disposes the old AnchorNode, which detaches its anchor.
169
+ ?.let { anchor = it }
170
+ }
152
171
  }
153
- true
154
- }
172
+ )
155
173
  ) {
156
174
  anchor?.let { a ->
157
175
  AnchorNode(anchor = a) {
@@ -185,7 +203,7 @@ In Xcode: **File > Add Package Dependencies** > paste:
185
203
  \`\`\`
186
204
  https://github.com/sceneview/sceneview
187
205
  \`\`\`
188
- Set version rule to **"from: ${LATEST_SCENEVIEW_RELEASE}"**.
206
+ Set version rule to **"Exact Version 4.68.0"**.
189
207
 
190
208
  Or in Package.swift:
191
209
  \`\`\`swift
@@ -196,7 +214,7 @@ let package = Package(
196
214
  name: "MyApp",
197
215
  platforms: [.iOS(.v18), .macOS(.v15), .visionOS(.v1)],
198
216
  dependencies: [
199
- .package(url: "https://github.com/sceneview/sceneview", from: "${LATEST_SCENEVIEW_RELEASE}")
217
+ .package(url: "https://github.com/sceneview/sceneview", exact: "4.68.0")
200
218
  ],
201
219
  targets: [
202
220
  .executableTarget(
@@ -267,8 +285,10 @@ SceneViewSwift provides ${IOS_NODE_TYPE_COUNT} node types:
267
285
  | \`BillboardNode\` | Camera-facing nodes (labels, health bars, icons) |
268
286
  | \`VideoNode\` | Video playback on a 3D plane |
269
287
  | \`ImageNode\` | Image display on a 3D plane |
288
+ | \`ContactShadowNode\` | Soft contact shadow decal that grounds an object on a floor, table or wall |
270
289
  | \`LineNode\` | Line segments between 3D points |
271
290
  | \`PathNode\` | Connected line paths through multiple points |
291
+ | \`TubeNode\` | Solid tube swept along a polyline (one continuous mesh) |
272
292
  | \`MeshNode\` | Custom mesh geometry with vertex data |
273
293
  | \`ShapeNode\` | 2D polygon shapes, flat or extruded |
274
294
  | \`ViewNode\` | Placeholder plane for embedding a SwiftUI view (content not rendered yet) |
@@ -285,7 +305,7 @@ const IOS_AR = `## SceneViewSwift — iOS AR Setup
285
305
  ### 1. SPM Dependency
286
306
 
287
307
  \`\`\`swift
288
- .package(url: "https://github.com/sceneview/sceneview", from: "${LATEST_SCENEVIEW_RELEASE}")
308
+ .package(url: "https://github.com/sceneview/sceneview", exact: "4.68.0")
289
309
  \`\`\`
290
310
 
291
311
  ### 2. Info.plist — Camera Permission (Required)
@@ -400,7 +420,7 @@ fun main() {
400
420
  directional()
401
421
  intensity(100_000.0)
402
422
  }
403
- model("models/DamagedHelmet.glb")
423
+ model("https://sceneview.github.io/models/platforms/moto_helmet_v2.glb") // Motorcycle Helmet by sayedgamal655, CC-BY 4.0
404
424
  autoRotate()
405
425
  },
406
426
  onReady = { sceneView ->
@@ -533,7 +553,8 @@ dependencies:
533
553
  <uses-permission android:name="android.permission.CAMERA" />
534
554
  <uses-feature android:name="android.hardware.camera.ar" android:required="true" />
535
555
  <application>
536
- <meta-data android:name="com.google.ar.core" android:value="required" />
556
+ <!-- arsceneview declares "optional": overriding it needs xmlns:tools="http://schemas.android.com/tools" on <manifest> -->
557
+ <meta-data android:name="com.google.ar.core" android:value="required" tools:replace="android:value" />
537
558
  </application>
538
559
  \`\`\`
539
560
 
@@ -679,7 +700,8 @@ Add to \`AndroidManifest.xml\`:
679
700
  <uses-permission android:name="android.permission.CAMERA" />
680
701
  <uses-feature android:name="android.hardware.camera.ar" android:required="true" />
681
702
  <application>
682
- <meta-data android:name="com.google.ar.core" android:value="required" />
703
+ <!-- arsceneview declares "optional": overriding it needs xmlns:tools="http://schemas.android.com/tools" on <manifest> -->
704
+ <meta-data android:name="com.google.ar.core" android:value="required" tools:replace="android:value" />
683
705
  </application>
684
706
  \`\`\`
685
707
 
@@ -852,7 +874,7 @@ const SETUPS = {
852
874
  ios: {
853
875
  name: "iOS / macOS / visionOS (SwiftUI)",
854
876
  renderer: "RealityKit (Metal)",
855
- status: `Alpha (v${LATEST_SCENEVIEW_RELEASE})`,
877
+ status: "End of life at 4.68.0",
856
878
  guide3d: IOS_3D,
857
879
  guideAr: IOS_AR,
858
880
  },
@@ -866,14 +888,14 @@ const SETUPS = {
866
888
  flutter: {
867
889
  name: "Flutter (PlatformView bridge)",
868
890
  renderer: "Filament (Android) / RealityKit (iOS)",
869
- status: "Alpha",
891
+ status: "End of life at 4.68.0",
870
892
  guide3d: FLUTTER_3D,
871
893
  guideAr: FLUTTER_AR,
872
894
  },
873
895
  "react-native": {
874
896
  name: "React Native (Fabric bridge)",
875
897
  renderer: "Filament (Android) / RealityKit (iOS)",
876
- status: "Alpha",
898
+ status: "End of life at 4.68.0",
877
899
  guide3d: REACT_NATIVE_3D,
878
900
  guideAr: REACT_NATIVE_AR,
879
901
  },
package/dist/preview.js CHANGED
@@ -5,7 +5,8 @@
5
5
  // 1. Model URL → direct model-viewer embed link
6
6
  // 2. Code snippet → embed link with default model + code panel
7
7
  const PREVIEW_BASE = "https://sceneview.github.io/preview";
8
- const DEFAULT_MODEL_URL = "https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/DamagedHelmet/glTF-Binary/DamagedHelmet.glb";
8
+ // Motorcycle Helmet by sayedgamal655, CC-BY 4.0, served from the SceneView website.
9
+ const DEFAULT_MODEL_URL = "https://sceneview.github.io/models/platforms/moto_helmet_v2.glb";
9
10
  /**
10
11
  * Build a sceneview.github.io/preview URL from the given options.
11
12
  *