Rapier 2D (@dimforge/rapier2d-compat 0.20) comes in as the physics engine: the editor loads it once in the background right after opening a project from its own chunk, so the main bundle grows by 0.19 KB gzip and the first frame does not wait; loadPhysics, physicsStatus and the 100 px = 1 m conversion live in src/runtime/physics/engine.ts, __gm.physics() reports the state, unit tests pin free fall and a box resting on a box, and e2e module 41 pins that Rapier is ready from its own chunk without console noise (#145)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6d7d0005cf
commit
d02bcca266
9 files changed
+143
-1
No files matched your search
@@ -2,6 +2,7 @@ import type { Application } from 'pixi.js';
|
||||
import { HttpFileStore } from '../core/store/HttpFileStore';
|
||||
import { HttpProjectStore } from '../core/store/HttpProjectStore';
|
||||
import type { StoredTexture, UploadedTexture } from '../core/store/TextureStore';
|
||||
import { loadPhysics } from '../runtime/physics/engine';
|
||||
import { requestRender, type VStack } from '../ui';
|
||||
import { fontLibrary } from '../viewport/FontLibrary';
|
||||
import { soundLibrary } from '../viewport/SoundLibrary';
|
||||
@@ -42,5 +43,6 @@ export async function startEditor(app: Application, root: VStack): Promise<void>
|
||||
fontLibrary.onChange(() => requestRender());
|
||||
installDebugHook(app, state, editor);
|
||||
await editor.boot();
|
||||
loadPhysics().catch((error: unknown) => console.error('[physics] Rapier could not be loaded:', error));
|
||||
await startPlugins(API_ENDPOINT, state, editor);
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import { findAsset, findAssetOf, findObjectHolder } from '../core/model/Project'
|
||||
import type { FrameRect } from '../core/model/texture';
|
||||
import { findLayer } from '../core/model/tilemap';
|
||||
import { effectiveScale, gameClock } from '../core/time';
|
||||
import { physicsStatus } from '../runtime/physics/engine';
|
||||
import {
|
||||
activeDrag,
|
||||
afterFrames,
|
||||
@@ -641,6 +642,7 @@ export function installDebugHook(app: Application, state: EditorState, editor: E
|
||||
sceneSelect: () => ({ ...centreOf(editor.sceneButton), enabled: editor.sceneButton.enabled }),
|
||||
/** Behaviors running without Play (`Run in editor`), and how long they have been at it. */
|
||||
editorRun: () => editor.editorRunInfo(),
|
||||
physics: () => physicsStatus(),
|
||||
/** Rows the hierarchy shows – collapsed subtrees are not in here. */
|
||||
hierarchyOrder: () => hierarchy.rowOrder(),
|
||||
hierarchyChevron: (id: string) => hierarchy.chevronPosition(id),
|
||||
|
||||
Reference in new issue
Block a user