Sitemap
Samsung Internet Developers

Writings from the Samsung Internet Developer Relations Team. For more info see our disclaimer: https://hub.samsunginter.net/about-blog

Use new Augmented Reality features with just a few lines of code with WebXR and AFrame!

4 min readAug 31, 2021

--

Lighting Estimation

A virtual object in a strong light source from the rear. The objects are back lit with accurate reflections, the shadows of the object stretch away from the real source light towards the viewer.

Hit Test

sceneEl.addEventListener('enter-vr', function () {
if (this.is('ar-mode')) {
message.textContent = '';
this.addEventListener('ar-hit-test-start', function () {
message.innerHTML = `Scanning environment, finding surface.`
}, { once: true });
this.addEventListener('ar-hit-test-achieved', function () {
message.innerHTML = `Select the location to place the furniture. By tapping on the screen or selecting with your controller.`
}, { once: true });
this.addEventListener('ar-hit-test-select', function () {
message.textContent = 'Object placed!';
}, { once: true });
}
});

Anchors

DOM Overlay

myButton.addEventListener('beforexrselect', e => {
e.preventDefault();
});

Get started now!

A preview of AR-Starter-Kit in AR and 2D the Browser

An example project

--

--

Samsung Internet Developers
Samsung Internet Developers

Published in Samsung Internet Developers

Writings from the Samsung Internet Developer Relations Team. For more info see our disclaimer: https://hub.samsunginter.net/about-blog

Ada Rose Cannon
Ada Rose Cannon

Written by Ada Rose Cannon

Co-chair of the W3C Immersive Web Working Group, Developer Advocate for Samsung.

Responses (2)