@@ -339,12 +339,13 @@ Quickly add an image to your scene
339
339
340
340
#### Model
341
341
342
- Quickly add a GLTF/GLB model to your scene. Will handle Suspense, KTX2, Draco, Meshopt.
342
+ Quickly add a GLTF/GLB model to your scene. Will handle Suspense, KTX2, Draco, Meshopt. Clones the gltf scene so the same file can be re-used.
343
343
344
344
``` tsx
345
345
<Model
346
346
src = " https://link-to-your-model.glb"
347
- center = { false } // whether to center the model so its bounds are centered on its origin
347
+ center // whether to center the model so its bounds are centered on its origin, default false
348
+ normalize // whether to normalize the model to a height/width/depth of 1, default false
348
349
/>
349
350
```
350
351
@@ -410,6 +411,33 @@ Enables colliders for its children either by a named collider mesh or using all
410
411
/>
411
412
```
412
413
414
+ #### Interactable
415
+
416
+ Makes its children react to onclick and on hover methods
417
+
418
+ ``` tsx
419
+ <Interactable
420
+ onClick = { () => console .log (" Ive been clicked!" )}
421
+ onHovered = { () => console .log (" Ive been hovered!" )}
422
+ onUnHovered = { () => console .log (" Ive been unhovered?" )}
423
+ >
424
+ <Stuff />
425
+ </Interactable >
426
+ ```
427
+
428
+ #### Anchor
429
+
430
+ Makes its children link out to when clicked. handles leaving vr session.
431
+
432
+ ``` tsx
433
+ <Anchor
434
+ href = " https://link-to-your-website.com"
435
+ target = " _blank" // optional, default is _self
436
+ >
437
+ <Stuff />
438
+ </Anchor >
439
+ ```
440
+
413
441
#### FacePlayer
414
442
415
443
Turns its children into a billboard, always facing the camera.
@@ -426,20 +454,6 @@ Lazily floats its children.
426
454
<Floating height = { 0.2 } speed = { 1 } />
427
455
```
428
456
429
- #### Interactable
430
-
431
- Makes its children react to onclick and on hover methods
432
-
433
- ``` tsx
434
- <Interactable
435
- onClick = { () => console .log (" Ive been clicked!" )}
436
- onHovered = { () => console .log (" Ive been hovered!" )}
437
- onUnHovered = { () => console .log (" Ive been unhovered?" )}
438
- >
439
- <Stuff />
440
- </Interactable >
441
- ```
442
-
443
457
#### LookAtPlayer
444
458
445
459
Makes its children face the player, but with easing.
@@ -502,6 +516,25 @@ An arrow icon
502
516
<Arrow dark = { false } />
503
517
```
504
518
519
+ #### Button
520
+
521
+ A simple button
522
+
523
+ ``` tsx
524
+ <Button
525
+ onClick = { () => console .log (" Ive been clicked!" )}
526
+ font = " https://link-to-your-font.ttf" // optional font, default is Quicksand
527
+ fontSize = { 0.1 } // font size, default 0.05
528
+ maxWidth = { 1 } // max width, default no max width
529
+ textColor = " red" // text color, default black
530
+ color = " green" // button color, default white
531
+ outline = { false } // whether to show an outline, default true
532
+ outlineColor = " #9f9f9f" // outline color, default white
533
+ >
534
+ Click me!
535
+ </Button >
536
+ ```
537
+
505
538
#### Switch
506
539
507
540
A boolean switch
@@ -510,7 +543,7 @@ A boolean switch
510
543
const [value, setValue] = useState (false );
511
544
512
545
<Switch
513
- value = { value } // value and setValue are optional but obviously recommended
514
- setValue = { setValue }
546
+ value = { value } // control the switch value
547
+ onChange = { setValue } // optional onChange function
515
548
/>;
516
549
```
0 commit comments