sceneview-mcp 4.1.1 → 4.2.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.
- package/README.md +33 -15
- package/dist/advanced-guides.js +62 -20
- package/dist/android-docs.js +1 -2
- package/dist/artifact.js +24 -1
- package/dist/debug-issue.js +22 -13
- package/dist/extra-guides.js +47 -17
- package/dist/generate-model-runware.js +221 -0
- package/dist/generate-model.js +66 -13
- package/dist/generate-scene.js +26 -5
- package/dist/generated/llms-txt.js +1 -1
- package/dist/generated/symbols.js +1587 -55
- package/dist/generated/version.js +5 -5
- package/dist/guides.js +27 -10
- package/dist/http.js +1 -1
- package/dist/issues.js +1 -1
- package/dist/migrate-code.js +7 -7
- package/dist/migration.js +6 -6
- package/dist/platform-setup.js +31 -9
- package/dist/preview.js +2 -1
- package/dist/samples.js +113 -51
- package/dist/tools/definitions.js +8 -3
- package/dist/tools/handler.js +7 -27
- package/dist/tools/index.js +1 -1
- package/dist/validator.js +2 -2
- package/dist/widgets.js +8 -1
- package/package.json +1 -1
|
@@ -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.
|
|
8
|
-
export const LATEST_SCENEVIEW_RELEASE = "4.
|
|
7
|
+
export const PACKAGE_VERSION = "4.2.0";
|
|
8
|
+
export const LATEST_SCENEVIEW_RELEASE = "4.67.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.
|
|
12
|
+
export const LATEST_FLUTTER_PUB_RELEASE = "4.63.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
|
+
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
|
@@ -199,7 +199,7 @@ viewModelScope.launch(Dispatchers.IO) {
|
|
|
199
199
|
|
|
200
200
|
### ARCore Threading
|
|
201
201
|
- \`Session.update()\` must run on the main thread (SceneView handles this via \`onSessionUpdated\`).
|
|
202
|
-
- \`
|
|
202
|
+
- \`createAnchorOrNull()\` on an ARCore hit from \`frame.hitTest(event)\` is safe on the main thread (gesture callbacks such as \`onSingleTapConfirmed\` run on main).
|
|
203
203
|
- Cloud anchor hosting/resolving is async — SceneView's \`CloudAnchorNode\` handles the callbacks correctly.
|
|
204
204
|
`;
|
|
205
205
|
export const BEST_PRACTICES = {
|
|
@@ -234,7 +234,7 @@ export const TROUBLESHOOTING_GUIDE = `# SceneView Troubleshooting Guide
|
|
|
234
234
|
1. \`rememberModelInstance\` returns null while loading — are you null-checking it?
|
|
235
235
|
2. Is the model path correct? Assets go in \`src/main/assets/models/\`
|
|
236
236
|
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) })\`
|
|
237
|
+
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
238
|
5. Is the camera pointing at the model? Default camera is at origin looking -Z
|
|
239
239
|
|
|
240
240
|
### AR Camera Feed Shows but No Planes Detected
|
|
@@ -246,7 +246,7 @@ export const TROUBLESHOOTING_GUIDE = `# SceneView Troubleshooting Guide
|
|
|
246
246
|
|
|
247
247
|
### "ARCore not installed" on Device
|
|
248
248
|
**Fix:**
|
|
249
|
-
- Ensure \`<meta-data android:name="com.google.ar.core" android:value="required" />\` is in manifest
|
|
249
|
+
- 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
250
|
- Install Google Play Services for AR from Play Store
|
|
251
251
|
- Some emulators don't support ARCore — test on a real device
|
|
252
252
|
|
|
@@ -268,7 +268,7 @@ export const TROUBLESHOOTING_GUIDE = `# SceneView Troubleshooting Guide
|
|
|
268
268
|
- Reduce model polygon count (< 100K triangles)
|
|
269
269
|
- Use KTX2 compressed textures (1024x1024 max)
|
|
270
270
|
- Avoid per-frame allocations in \`onFrame\` callbacks
|
|
271
|
-
-
|
|
271
|
+
- Lighten or disable post-processing if not needed: \`SceneView(renderQuality = RenderQuality.Performance)\`, or \`view.isPostProcessingEnabled = false\` on the Filament \`View\`
|
|
272
272
|
- Profile with Android GPU Inspector
|
|
273
273
|
|
|
274
274
|
### High Memory Usage
|
|
@@ -457,7 +457,8 @@ dependencies {
|
|
|
457
457
|
<!-- Required: tells Play Store this app needs ARCore -->
|
|
458
458
|
<!-- Use "required" to block installs on non-AR devices -->
|
|
459
459
|
<!-- Use "optional" to allow install but degrade gracefully -->
|
|
460
|
-
|
|
460
|
+
<!-- arsceneview declares "optional": overriding it needs xmlns:tools="http://schemas.android.com/tools" on <manifest> -->
|
|
461
|
+
<meta-data android:name="com.google.ar.core" android:value="required" tools:replace="android:value" />
|
|
461
462
|
|
|
462
463
|
<!-- Required ONLY for Cloud Anchors / Geospatial / Streetscape.
|
|
463
464
|
Inject via manifestPlaceholders in app/build.gradle (read from
|
|
@@ -561,18 +562,34 @@ ARSceneView(
|
|
|
561
562
|
|
|
562
563
|
### Tap-to-Place with Anchor
|
|
563
564
|
\`\`\`kotlin
|
|
565
|
+
import com.google.ar.core.Anchor
|
|
566
|
+
import com.google.ar.core.Frame
|
|
567
|
+
import com.google.ar.core.Plane
|
|
568
|
+
import io.github.sceneview.ar.arcore.createAnchorOrNull
|
|
569
|
+
import io.github.sceneview.rememberOnGestureListener
|
|
570
|
+
// …plus androidx.compose.runtime.* and the io.github.sceneview entry points (ARSceneView, rememberEngine, …)
|
|
571
|
+
|
|
564
572
|
var anchor by remember { mutableStateOf<Anchor?>(null) }
|
|
573
|
+
var latestFrame by remember { mutableStateOf<Frame?>(null) }
|
|
565
574
|
|
|
566
575
|
ARSceneView(
|
|
567
576
|
engine = engine,
|
|
568
577
|
modelLoader = modelLoader,
|
|
569
578
|
planeRenderer = true,
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
579
|
+
onSessionUpdated = { _, frame -> latestFrame = frame },
|
|
580
|
+
// A confirmed single tap, never a raw ACTION_UP: the end of a drag or a pinch on the
|
|
581
|
+
// placed model must not move it. Leaving onTouchEvent unset keeps the model's gestures.
|
|
582
|
+
onGestureListener = rememberOnGestureListener(
|
|
583
|
+
onSingleTapConfirmed = { event, node ->
|
|
584
|
+
if (node == null) { // empty space, not the placed model
|
|
585
|
+
latestFrame?.hitTest(event)
|
|
586
|
+
?.firstOrNull { (it.trackable as? Plane)?.isPoseInPolygon(it.hitPose) == true }
|
|
587
|
+
?.createAnchorOrNull()
|
|
588
|
+
// Replacing the state key disposes the old AnchorNode, which detaches its anchor.
|
|
589
|
+
?.let { anchor = it }
|
|
590
|
+
}
|
|
573
591
|
}
|
|
574
|
-
|
|
575
|
-
}
|
|
592
|
+
)
|
|
576
593
|
) {
|
|
577
594
|
anchor?.let { a ->
|
|
578
595
|
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
|
|
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
|
{
|
package/dist/migrate-code.js
CHANGED
|
@@ -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 =
|
|
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 =
|
|
99
|
-
explanation: "Manual `worldPosition` in AR causes drift. Use `AnchorNode(anchor =
|
|
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 →
|
|
150
|
+
// ── onTapArPlane → onSingleTapConfirmed ────────────────────────────
|
|
151
151
|
{
|
|
152
152
|
id: "replace-onTapArPlane",
|
|
153
153
|
pattern: /\.onTapArPlane\s*\{/g,
|
|
154
|
-
replacement: "// .onTapArPlane removed — use ARSceneView(
|
|
155
|
-
explanation: "`.onTapArPlane` removed.
|
|
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 `
|
|
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 =
|
|
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 =
|
|
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.
|
|
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\` → \`
|
|
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(
|
|
278
|
+
| \`arFragment.setOnTapArPlaneListener\` | \`ARSceneView(onGestureListener = rememberOnGestureListener(onSingleTapConfirmed = { event, node -> … }))\` |
|
|
279
279
|
| \`arFragment.arSceneView\` | Direct access via composable params |
|
|
280
280
|
|
|
281
281
|
---
|
package/dist/platform-setup.js
CHANGED
|
@@ -107,7 +107,8 @@ dependencies {
|
|
|
107
107
|
<uses-feature android:name="android.hardware.camera.ar" android:required="true" />
|
|
108
108
|
|
|
109
109
|
<application>
|
|
110
|
-
|
|
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
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
|
|
154
|
-
}
|
|
172
|
+
)
|
|
155
173
|
) {
|
|
156
174
|
anchor?.let { a ->
|
|
157
175
|
AnchorNode(anchor = a) {
|
|
@@ -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) |
|
|
@@ -400,7 +420,7 @@ fun main() {
|
|
|
400
420
|
directional()
|
|
401
421
|
intensity(100_000.0)
|
|
402
422
|
}
|
|
403
|
-
model("models/
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
*
|