You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api.md
+89-6
Original file line number
Diff line number
Diff line change
@@ -3,8 +3,6 @@ AR API
3
3
4
4
[🔙](../README.md)
5
5
6
-
TODO all features of ARCommonNode, ARAddOptions, ARImageTrackingActions, etc
7
-
8
6
The easiest way to obtain a reference to the `AR` object is by grabbing it from the `arLoaded` event you bind in the view:
9
7
10
8
```typescript
@@ -19,21 +17,23 @@ class MyModel {
19
17
}
20
18
```
21
19
22
-
Then call one of the functions below, like `this.ar.addModel({})`:
20
+
Then call one of the 'add*' functions below, like `this.ar.addModel()`:
23
21
24
22
-[add*](#add)
25
-
26
23
-[addNode](#addnode)
27
24
-[addModel](#addmodel)
28
25
-[addBox](#addbox)
26
+
-[addPlane](#addplane)
29
27
-[addSphere](#addsphere)
30
28
-[addTube](#addtube)
31
29
-[addText](#addtext)
32
30
-[addImage](#addimage)
31
+
-[addVideo](#addvideo)
33
32
-[addUIView](#adduiview)
34
33
34
+
Or one of the other functions:
35
+
-[trackImage](#trackimage)
35
36
-[isSupported](#issupported-static)
36
-
37
37
-[grabScreenshot](#grabscreenshot-ios)
38
38
39
39
## `add*`
@@ -54,6 +54,11 @@ position: ARPosition = {
54
54
}
55
55
```
56
56
57
+
#### `parentNode`
58
+
Instead of adding a node relative to the camera, you can add it to another node that's already part of the scene.
59
+
60
+
We leverage this feature in the Solar System demo by [adding life to planets](https://github.com/EddyVerbruggen/nativescript-ar/blob/77d1d4585f0f92aa2d6f6de494c528f7895e2b28/demo-solarsystem/app/components/App.vue#L350).
61
+
57
62
#### `scale` (optional)
58
63
This can either be a `number` or an `ARScale`:
59
64
@@ -83,7 +88,16 @@ rotation: ARRotation = {
83
88
}
84
89
```
85
90
86
-
#### `mass` (optional, iOS only)
91
+
#### `draggingEnabled`
92
+
Set this to `true` to enable moving objects around.
93
+
94
+
#### `rotatingEnabled`
95
+
Set this to `true` to enable rotating objects.
96
+
97
+
#### `scalingEnabled`
98
+
Set this to `true` to enable scaling of objects.
99
+
100
+
#### `mass` (iOS only)
87
101
By default objects don't have a mass so they're not subject to gravity and don't 'fall'.
88
102
89
103
If you want the object to fall you may also want to increase the `position.y` (for a higher drop).
As you can see in the example above, the returned `ARVideoNode` provides these methods for further interaction: `isPlaying`, `pause`, `play`.
441
+
385
442
## `addUIView`
386
443
This one is a bit tricky and requires some tinkering with sizes and positioning because the rendered view may differ a bit between platforms.
387
444
@@ -434,6 +491,32 @@ ar.addUIView({
434
491
435
492
For more details, please see [this implementation](https://github.com/EddyVerbruggen/nativescript-ar/blob/master/demo-solarsystem/app/components/App.vue) in the Solar System demo app.
436
493
494
+
## `trackImage`
495
+
You can either track images by providing an image bundle [like so](https://github.com/EddyVerbruggen/nativescript-ar/blob/c13ca5c000a660069ee74506330be41e74b565e3/demo-pokemon/src/app/search-by-card/search-by-card.component.html#L38),
496
+
but also non-bundled images (even from the web!) by using this `trackImage` function.
497
+
498
+
> On iOS this is supported with `trackingMode` either `WORLD` or `IMAGE`. On Android only with `IMAGE`.
0 commit comments