Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

feat: add physics initialization readiness API

esengine5c1260125e07
diff --git a/sdk/src/app.ts b/sdk/src/app.ts
index 17bd7d736..26eebdf0a 100644
--- a/sdk/src/app.ts
+++ b/sdk/src/app.ts
@@ -236,6 +236,18 @@ export class App {
this.physicsModule_ = m;
}
+ async waitForPhysics(): Promise<void> {
+ if (!this.physicsInitPromise_) {
+ console.warn('[ESEngine] No PhysicsPlugin installed, waitForPhysics() is a no-op');
+ return;
+ }
+ await this.physicsInitPromise_;
+ }
+
+ get isPhysicsReady(): boolean {
+ return this.physicsModule_ != null;
+ }
+
// =========================================================================
// World Access
// =========================================================================