I’m trying to load a react native glb file, with JavaScript.
but i am getting the following problem
Error: Protocol version mismatch: 2 (Native) !== 6 (JS)
NativeEngine@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.apptalk&modulesOnly=false&runModule=true:257550:24
construct@[native code]
my code:
useEffect(() => {
if (engine) {
const scene = new Scene(engine);
const camera = new ArcRotateCamera(
'camera',
-Math.PI / 2,
Math.PI / 2,
5,
Vector3.Zero(),
scene,
);
setCamera(scene.activeCamera);
scene.createDefaultLight(true);
// scene.addParticleSystem();
const rootNode = new TransformNode('Root Container', scene);
setRootNode(rootNode);
const transformContainer = new TransformNode(
'Transform Container',
scene,
);
transformContainer.parent = rootNode;
transformContainer.scaling.scaleInPlace(0.2);
transformContainer.position.y -= 0.2;
scene.beforeRender = () => {
transformContainer.rotate(
Vector3.Up(),
0.005 * scene.getAnimationRatio(),
);
};
SceneLoader.ImportMesh(
null,
'https://models.babylonjs.com/',
'seagulf.glb',
scene,
(newMeshes, particleSystems, skeletons, animationGroups) => {
const hero = newMeshes[0];
// Scale the model down
hero.scaling.scaleInPlace(0.1);
// Lock camera on the character
camera.target = hero;
// Get the Samba animation Group
const sambaAnim = scene.getAnimationGroupByName('Samba');
// Play the Samba animation
sambaAnim.start(true, 1.0, sambaAnim.from, sambaAnim.to, false);
},
);
}
}, [engine]);
I noticed that in the if inside the useEffect he could not enter
version:
“@babylonjs/core”: “^5.0.0-alpha.50”,
“@babylonjs/loaders”: “^5.0.0-alpha.50”,
“@babylonjs/react-native”: “^0.4.0-alpha.37”
“react”: “17.0.1”,
“react-native”: “0.64.1”,