Hello team,
Is vertical wall positioning possible in Android AR. Saw a previous post regarding using hit test from WebXR API. Checking in to see if it is the same.
Hello team,
Is vertical wall positioning possible in Android AR. Saw a previous post regarding using hit test from WebXR API. Checking in to see if it is the same.
Hi Vijay NV,
Vertical wall positioning in Android AR is indeed possible using hit testing with the WebXR API. When you perform a hit test, you can determine where surfaces are in the environment, which can include vertical walls.
To implement this, you would typically use the XRHitTestSource
from the WebXR API to get a hit result based on user input (like a controller’s position). This can help you position virtual objects on vertical walls accurately.
Here is a basic approach in pseudocode:
Here’s a simplified example code snippet:
// JavaScript example for hit testing in WebXR
async function setupXR() {
const session = await navigator.xr.requestSession('immersive-vr');
const hitTestSource = await session.requestHitTestSource({ space: viewerSpace });
session.requestAnimationFrame(onXRFrame);
}
function onXRFrame(time, frame) {
// Get the XR frame data
const referenceSpace = session.getReferenceSpace();
const hitTestResults = frame.getHitTestResults(hitTestSource);
if (hitTestResults.length > 0) {
const hit = hitTestResults[0];
// Position your object based on hit results
yourObject.position.set(hit.transform.position.x, hit.transform.position.y, hit.transform.position.z);
}
}
Make sure to refer to the WebXR documentation for more detailed information about setting up sessions and working with hit testing (see the documentation) (see the documentation).
If you provide more context or specifications, I can offer more tailored advice or code examples.
1 replies left - Get a PRO license for more AI replies.
thread_EEmbpZoGjZPkVkUFzXgiX70t
Reply to this message to continue the conversation