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
this hoc allows you to create 3D components where the position is always relative to the same point on the screen/camera, but sticks to a plane or object.
319
+
320
+
Think about a 3D cursor that can be moved across your table or a 3D cursor on a wall.
Given you have detected a plane with onPlaneDetected, you can make the cursor stick to that plane:
347
+
348
+
```
349
+
<Cursor3D projectPosition={{
350
+
x: windowWidth / 2,
351
+
y: windowHeight / 2,
352
+
plane: "my-planeId"
353
+
}}
354
+
/>
355
+
356
+
```
357
+
358
+
If you don't have the id, but want to place the cursor on a certain plane (e.g. the first or last one), pass a function for plane. This function will get all hit-results and you can return the one you need:
It uses https://developer.apple.com/documentation/arkit/arframe/2875718-hittest with some default options. Please file an issue or send a PR if you need more control over the options here!
371
+
372
+
##### Attach to a given 3D object
373
+
374
+
You can attach the cursor on a 3D object, e.g. a non-horizontal-plane or similar:
375
+
376
+
Given there is some 3D object on your scene with `id="my-nodeId"`
377
+
378
+
```
379
+
<Cursor3D projectPosition={{
380
+
x: windowWidth / 2,
381
+
y: windowHeight / 2,
382
+
node: "my-nodeId"
383
+
}}
384
+
/>
385
+
```
386
+
387
+
Like with planes, you can select the node with a function.
388
+
389
+
E.gl you have several "walls" with ids "wall_1", "wall_2", etc.
It uses https://developer.apple.com/documentation/scenekit/scnscenerenderer/1522929-hittest with some default options. Please file an issue or send a PR if you need more control over the options here!
0 commit comments