... | @@ -198,3 +198,16 @@ Navigate to the webpage you created from your device. You should be able to view |
... | @@ -198,3 +198,16 @@ Navigate to the webpage you created from your device. You should be able to view |
|
The complete code can be downloaded [cube.html](uploads/ac0260539a69bb6d5e8c440ac33c353e/cube.html) and a live demo can be acceded [here](https://transfer.hft-stuttgart.de/pages/muhammad.alfakhori/ar/1-Cube.html).
|
|
The complete code can be downloaded [cube.html](uploads/ac0260539a69bb6d5e8c440ac33c353e/cube.html) and a live demo can be acceded [here](https://transfer.hft-stuttgart.de/pages/muhammad.alfakhori/ar/1-Cube.html).
|
|
|
|
|
|
|
|
|
|
|
|
# Tap to place
|
|
|
|
A common way of interacting with the AR world is through a **hit test**, which finds an intersection between a ray and real-world geometry. In Hello WebXR, you'll use a hit test to place a sunflower in the virtual world.
|
|
|
|
|
|
|
|
## Remove the demo cube
|
|
|
|
Remove the unlit cube and replace it with a scene that includes lighting:
|
|
|
|
```
|
|
|
|
const scene = new THREE.Scene();
|
|
|
|
|
|
|
|
const directionalLight = new THREE.DirectionalLight(0xffffff, 0.3);
|
|
|
|
directionalLight.position.set(10, 15, 10);
|
|
|
|
scene.add(directionalLight);
|
|
|
|
```
|
|
|
|
|