From 1b0e8fa9e67a38a3d7ea581080b575f1515f6cdc Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 15 Aug 2024 09:53:03 +0800 Subject: [PATCH 1/2] export Bullet --- cocos/physics/bullet/instantiated.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/cocos/physics/bullet/instantiated.ts b/cocos/physics/bullet/instantiated.ts index 26c71542e84..c490be21ea3 100644 --- a/cocos/physics/bullet/instantiated.ts +++ b/cocos/physics/bullet/instantiated.ts @@ -87,6 +87,7 @@ interface BtCache { // eslint-disable-next-line import/no-mutable-exports export let bt = {} as Bullet.instance; +globalThis.Bullet = bt as any; export const btCache = {} as BtCache; btCache.BODY_CACHE_NAME = 'body'; btCache.CCT_CACHE_NAME = 'cct'; From 0f8f5ab5612b80f7e27bf33b91827182ef164caf Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 15 Aug 2024 11:46:50 +0800 Subject: [PATCH 2/2] init Bullet correctly --- cocos/physics/bullet/instantiated.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/physics/bullet/instantiated.ts b/cocos/physics/bullet/instantiated.ts index c490be21ea3..fe80ccd76e0 100644 --- a/cocos/physics/bullet/instantiated.ts +++ b/cocos/physics/bullet/instantiated.ts @@ -87,7 +87,6 @@ interface BtCache { // eslint-disable-next-line import/no-mutable-exports export let bt = {} as Bullet.instance; -globalThis.Bullet = bt as any; export const btCache = {} as BtCache; btCache.BODY_CACHE_NAME = 'body'; btCache.CCT_CACHE_NAME = 'cct'; @@ -108,6 +107,7 @@ function initWASM (wasmFactory, wasmUrl: string): Promise { }).then((instance: any) => { log('[bullet]:bullet wasm lib loaded.'); bt = instance as Bullet.instance; + globalThis.Bullet = bt as any; }).then(resolve).catch((err: any) => reject(errorMessage(err))); }); }