Closed methot-ilya-3ds closed 2 years ago
Looks like you need to mark it as optional - look at the last parameter required
of enableFeature(...)
:
https://github.com/BabylonJS/Babylon.js/blob/master/src/XR/webXRFeaturesManager.ts#L339
@brianzinn The problem seems more related to the fact that WebXRFeatureName does not contain IMAGE_TRACKING.
I am not sure if the feature has been implemented in react-babylonjs or not.
Are you on @latest of @babylonjs/core?
Can you share more code?
My current version is:
"@babylonjs/core": "^4.2.0",
Here is some additional code in case it helps:
import React from "react";
import {
FreeCamera,
Vector3,
HemisphericLight,
MeshBuilder,
WebXRFeatureName,
GroundBuilder,
Quaternion,
StandardMaterial,
Color3
} from "@babylonjs/core";
import SceneComponent from "./SceneComponent"; // uses above component in same directory
// import SceneComponent from 'babylonjs-hook'; // if you install 'babylonjs-hook' NPM.
let box;
const onSceneReady = async (scene) => {
const xr = await scene.createDefaultXRExperienceAsync({
uiOptions: {
sessionMode: 'immersive-ar'
}
});
const fm = xr.baseExperience.featuresManager;
// enable the feature
const imageTracking = fm.enableFeature(WebXRFeatureName.IMAGE_TRACKING, 'latest', {
images: [
{
src: 'https://URL/image1.jpg',
estimatedRealWorldWidth: 0.3
},
{
src: 'https://URL/image2.jpg',
estimatedRealWorldWidth: 0.3
}
]
});
I’m pretty sure that is a v5 thing. I’ll check once I get to a computer
I've looked in the 4.2 NPM and there is no image tracking. Sorry for late reply. These are available in 4.2:
WebXRFeatureName.ANCHOR_SYSTEM = "xr-anchor-system";
WebXRFeatureName.BACKGROUND_REMOVER = "xr-background-remover";
WebXRFeatureName.HIT_TEST = "xr-hit-test";
WebXRFeatureName.PHYSICS_CONTROLLERS = "xr-physics-controller";
WebXRFeatureName.PLANE_DETECTION = "xr-plane-detection";
WebXRFeatureName.POINTER_SELECTION = "xr-controller-pointer-selection";
WebXRFeatureName.TELEPORTATION = "xr-controller-teleportation";
WebXRFeatureName.FEATURE_POINTS = "xr-feature-points";
WebXRFeatureName.HAND_TRACKING = "xr-hand-tracking";
You will need v5 - it's still in alpha, but is very stable - would recommend upgrading.
Clone of the following github issue:
I'm trying to implement the feature WebXRFeatureName.IMAGE_TRACKING using the example code from #9512
But throws the following error:
https://github.com/BabylonJS/Babylon.js/issues/9997