We are currently testing the Zappar AR framework, which appears to rely on the babylonjs legacy packages (import * as BABYLON from 'babylonjs'), while our code is using the ES6 packages (import { x } from '@babylonjs/core/...;).
When instantiating a Zappar camera, one needs to give it a Scene as an argument, just like with the regular Babylon camera object.
However, our ES6 Scene is not accepted, with typescript complaining about the legacy Scene Zappar is using and the ES6 Scene we are using to be incompatible.
Are you mixing two types of packages? How does your package.json look like?
in the same version they SHOULD be the same, but we don’t recommend mixing the two types of packages. if you are in @babylonjs/*** , stay there and don’t use the UMD package.
since Zappar is based on the legacy package and our codebase uses @babylonjs/*** , we’re kind of forced to install both versions of Babylon. Otherwise the Zappar framework complains, because it appears to use the old version internally.
Thus, the package.json would require us to install both “babylonjs” as well as “@babylonjs/…”
The babylon scene we created in our software is based on the ES6 version, and Zappar refuses to accept it when instantiating a Zappar camera. Stating, our scene is incompatible with what they want, namely a scene based on the old babylon framework.
So I was hoping to find a way to circumvent this problem by maybe converting between the two versions.
Not quite! Those are two different packages that are not related. Well, at least not on npm-level, or the way we deal with dependencies. The UMD packages depend on other UMD packages, the es6 ones depend on the other es6 package, and they can’t mix… The packages are keeping state in them that cannot be mixed (both packages still count on side-effects being executed and on static members that are a part of this specific package).
My only recommendation to you is to use the UMD version in your code as well, or ask Zapper to update their codebase to work with the es6 version, which is much better in terms of packaging and deployment. I would recommend zapper to make this package - @zappar/zappar-babylonjs - npm depend on the es version of babylon, while making the CDN version depend on the UMD package, but this is their decision.
I am sorry I can’t provide a better answer… The Zapper team was active in the forum, pinging them: