pxim
June 25, 2023, 5:38am
1
example: Babylon.js Playground (babylonjs.com)
In Playground online cases, the Physics Bodies grid display is normal.
But in my local development environment, I use ES6 to introduce the BABYLON library to get it. The grid display is abnormal.
Except for the different ways to import the bag, other code is exactly the same. I don’t know why this is like this.
import * as BABYLON from "@babylonjs/core";
import "@babylonjs/loaders/glTF";
import "@babylonjs/core/Rendering/outlineRenderer";
// import "@babylonjs/core/Debug/debugLayer";
import "@babylonjs/inspector";
// import "@babylonjs/core/Debug/debugLayer";
import HavokPhysics from "@babylonjs/havok";
import '@babylonjs/loaders';
...
code in codesanbox
I tried to make an ES6 case with Codesanbox, but it reported WASM errors.
happy-flower-379yyj by pxim using @babylonjs/accessibility, @babylonjs/core, @babylonjs/gui, @babylonjs/gui-editor, @babylonjs/havok, @babylonjs/inspector, @babylonjs/loaders, @babylonjs/materials, @babylonjs/node-editor
pxim
June 26, 2023, 9:32am
2
It is normal to import a package to this
Adding @RaananW the master of all build things
1 Like
Yes, this looks right. But not if you have the @babylonjs /core package as dependency. You should import the classes you need from @babylonjs /docs (and leave the “babylonjs” out of the project).
It will also work better with Havok.
In general, try working with the es6 packages (the ones beginning with “@babylonjs ”) and less with the umd packages
pxim
June 27, 2023, 9:25am
5
It is precisely because of the problem with @babylonjs /core,
Then there is no @babylonjs /docs in npmjs.
sorry, that was a typo on my end. i meant @babylonjs /core
pxim
June 28, 2023, 7:28am
8
This is not a problem with ES6 use,
I think i has use it correct.
and
These two usages are theoretically correct.
But the rendering result is abnormal.
Forget it, don’t entangle this, I still use UMD
pxim
June 28, 2023, 8:03am
9
Using the warehouse you provided, I test it correct, but the @babylonjs /core version is different. I will try the same version and try
i @babylonjs /core 6.3.1
warehouse @babylonjs /core 6.0.0
11128
June 28, 2023, 8:22am
10
It could be for the same reason as this
Install version 6.6.1 or later
1 Like
pxim
June 28, 2023, 9:06am
11
Yes,Updated to version 6.9.0, it is normal.
It is indeed a problem with version 6.3.1.
My local UMD version is also 6.9.0, so it is normal.
Thanks very much.
2 Likes