Hi ,
So we are working on the next release of our project and in that we have to show certain items in AR.
For which we need feature like plane detection and hit test in AR.
I created a small demo using for AR but the object appeared where I am standing.
for this I followed this playground example
https://playground.babylonjs.com/#8Y780Y#66
But,
I was hoping to get something like this - three.js examples
Can you share some documentation or playground example for hit test and plane detection in AR using BabylonJS
DISCLAIMER - Please open URL in AR supported phone to experience AR
regards,
Nipun David
Hi,
So quick update - I was able to do the hit test but I was not able to move the chair on the location there is some error can you guys please check and let me know what is wrong. I guess I am missing something while initializing anchor…
Link I referred - WebXR Augmented Reality Features - Babylon.js Documentation
How to debug on mobile - Viewing Console Log from an Android Device | Damir's Corner.
My Demo -
JS File -
https://webxr.z10.web.core.windows.net/babylon_ar_test.js
Error when I tapped on the screen -
Uncaught (in promise) TypeError: Cannot read property 'createAnchor' of undefined
at t.<anonymous> (babylon.js:16)
at babylon.js:16
at Object.next (babylon.js:16)
at babylon.js:16
at new Promise (<anonymous>)
at s (babylon.js:16)
at t.addAnchorPointUsingHitTestResultAsync (babylon.js:16)
at t.scene.onPointerDown (babylon_ar_test.js:88)
at e._processPointerDown (babylon.js:16)
at e.simulatePointerDown (babylon.js:16)
This is because of this line -
anchors.addAnchorPointUsingHitTestResultAsync(hitTest);
. your hitTest variable is the hit test feature, but it should be the hitPoint, which is the result of the last hitTest.
1 Like