The static side every physics adapter class shares, next to its
constructor. load() resolves once the adapter can be constructed, and
create() waits for it, then constructs: an adapter whose engine is plain
JavaScript (the builtin, matter and planck adapters) resolves load() at
once, while one built on WebAssembly downloads and compiles it there. So
await X.create(options) is the same line for every adapter, at boot or
before World#setAdapter; new X(options) stays available wherever
the adapter needs no loading.
Example
constapp = newApplication(800, 600, { physic:awaitPlanckAdapter.create({ gravity: { x:0, y:320 } }), }); // later, between two screens app.world.setAdapter(awaitMatterAdapter.create());
The static side every physics adapter class shares, next to its constructor.
load()resolves once the adapter can be constructed, andcreate()waits for it, then constructs: an adapter whose engine is plain JavaScript (the builtin, matter and planck adapters) resolvesload()at once, while one built on WebAssembly downloads and compiles it there. Soawait X.create(options)is the same line for every adapter, at boot or before World#setAdapter;new X(options)stays available wherever the adapter needs no loading.Example