Visitar URL original
Add Inspector Lite physics inspection by ryantrem · Pull Request #19079 · BabylonJS/Babylon.js · GitHub
Skip to content

Add Inspector Lite physics inspection - #19079

Draft
ryantrem wants to merge 5 commits into
BabylonJS:masterfrom
ryantrem:ryantrem-inspector-lite-p10
Draft

ryantrem wants to merge 5 commits into
BabylonJS:masterfrom
ryantrem:ryantrem-inspector-lite-p10

Conversation

@ryantrem

@ryantrem ryantrem commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Adds the P10b Inspector UI for physics, allowing Lite applications to inspect and edit Havok physics worlds, bodies, shapes and constraints through the new public discovery APIs from BabylonJS/Babylon-Lite#869. This completes the Inspector-side work for P10 in BabylonJS/Babylon-Lite#55.

Changes

  • Add a Physics explorer section listing each physics world with its bodies (including thin-instance counts) and constraints. Lists are live, and removed bodies or released constraints disappear; constraints are hidden unless both endpoints are still live.
  • Add body properties: node and world links, motion and prestep type, shape (type, parameters, friction, restitution, filter masks, density), damping, gravity factor, velocity, mass, center of mass, inertia, and linked constraints. Native reads are gated on world/body list membership, edits to shared shapes show a warning, and non-finite mass inputs are rejected.
  • Add constraint properties: type, body links, enabled toggle, collision, pivots/axes and limits.
  • Add physics debug views (body wireframes, mass properties and constraints) using the Lite physics viewer, updated incrementally with hidePhysicsConstraint instead of rebuilding.
  • Add unit and Chrome integration coverage plus a lazily loaded Havok test fixture, and update the readme.
  • Update development dependencies to @babylonjs/lite@1.37.2 and raise Inspector's optional Lite peer minimum to ^1.37.2.

Limitations

Inspector v2's "Physics enabled" switch has no Lite equivalent. Mesh, convex hull, heightfield and container shapes don't report parameters, constraint pivots and axes come from the creation options, material combine modes aren't exposed, and thin-instance edits apply to all instances.

Validation

Against the published Lite 1.37.2 package:

  • Format check, ESLint on changed files, and build:source passed.
  • 258 focused Inspector Lite unit tests passed.
  • The 2 physics Chrome integration tests passed.

Screenshots

Inspector Lite showing the Physics explorer and a selected body's physics properties

Inspector Lite showing a selected hinge constraint's properties

Adds physics world, body, shape and constraint inspection and physics debug views to Inspector Lite, and updates @babylonjs/lite to 1.37.2 (BabylonJS/Babylon-Lite#55, P10b).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 29, 2026 02:27
@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Reviewer - this PR has made changes to one or more package.json files.

@deltakosh deltakosh self-assigned this Oct 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Mass-property edits can silently discard prior values and rotation-lock state, while unresolved visualization, helper-tracking, container-refresh, and polling-performance issues also remain.

5 open issues
What changed in this PR

Adds Havok physics inspection to Inspector Lite using Lite’s public discovery APIs, extending the explorer, property panes, and debug tools.

Changes:

  • Adds live physics-world, body, and constraint discovery with editable properties and navigation.
  • Adds independent body and constraint visualization with helper cleanup.
  • Adds unit and Chrome integration coverage, documents limitations, and updates Lite dependencies to 1.37.2.
File Description
packages/​public/​@babylonjs/​shared-ui-components/​package.json Updates Lite development dependency.
packages/​public/​@babylonjs/​inspector-v2/​package.json Raises Lite peer minimum and development dependency.
packages/​dev/​sharedUiComponents/​package.json Updates Lite development dependency.
packages/​dev/​inspector-v2/​test/​unit/​p4ImportBoundaries.test.ts Checks lazy, runtime-neutral physics imports.
packages/​dev/​inspector-v2/​test/​unit/​litePhysics.test.tsx Tests discovery, properties, edits, and liveness guards.
packages/​dev/​inspector-v2/​test/​unit/​liteDebugService.test.tsx Tests independent physics switches and availability.
packages/​dev/​inspector-v2/​test/​unit/​liteDebugController.test.ts Tests viewer reconciliation, cleanup, and failures.
packages/​dev/​inspector-v2/​test/​integration/​litePhysics.test.ts Adds Chrome physics inspection coverage.
packages/​dev/​inspector-v2/​test/​app/​litePhysics.ts Adds a real Havok integration fixture.
packages/​dev/​inspector-v2/​test/​app/​lite.ts Exposes lazy physics-fixture loading.
packages/​dev/​inspector-v2/​src/​lite/​services/​panes/​scene/​physicsExplorerService.tsx Adds live physics explorer nodes and selection cleanup.
packages/​dev/​inspector-v2/​src/​lite/​services/​panes/​properties/​physicsPropertiesService.tsx Registers lazy physics property sections.
packages/​dev/​inspector-v2/​src/​lite/​services/​panes/​debugService.tsx Adds body and constraint visualization switches.
packages/​dev/​inspector-v2/​src/​lite/​services/​panes/​debugController.ts Manages per-world physics viewers and helpers.
packages/​dev/​inspector-v2/​src/​lite/​sceneEntityUtils.ts Excludes tracked physics helpers from discovery.
packages/​dev/​inspector-v2/​src/​lite/​physicsUtils.ts Adds discovery, liveness, and display utilities.
packages/​dev/​inspector-v2/​src/​lite/​inspector.tsx Registers physics explorer and properties services.
packages/​dev/​inspector-v2/​src/​lite/​components/​properties/​physicsProperties.tsx Implements guarded physics property controls.
packages/​dev/​inspector-v2/​readme.md Documents physics features and limitations.
packages/​dev/​inspector-v2/​package.json Updates Lite development dependency.
package.json Updates the workspace Lite dependency.
package-lock.json Locks Lite 1.37.2 across affected packages.

Review effort: Balanced

@deltakosh deltakosh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ryantrem,

  • physicsProperties.tsx:547-569: editing Center of Mass after Mass discards the mass edit, because Lite rebuilds omitted properties from the shape. Please preserve the unedited values without overwriting the rotation-lock restoration data.
  • debugController.ts:466: thin-instance bodies get a single wireframe at the carrier origin rather than one per collider. Please use instance-aware visualization or explicitly exclude unsupported thin bodies.
  • debugController.ts:490: Lite's returned array omits the six constraint arrowheads, so they show up in Explorer and get bounding boxes. Please register every constraint helper.

Thanks!

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Snapshot stored with reference name:
refs/pull/19079/merge

Test environment:
https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/19079/merge/index.html

To test a playground add it to the URL, for example:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/19079/merge/index.html#WGZLGJ#4600

Links to test your changes to core in the published versions of the Babylon tools (does not contain changes you made to the tools themselves):

https://playground.babylonjs.com/?snapshot=refs/pull/19079/merge
https://sandbox.babylonjs.com/?snapshot=refs/pull/19079/merge
https://gui.babylonjs.com/?snapshot=refs/pull/19079/merge
https://nme.babylonjs.com/?snapshot=refs/pull/19079/merge

To test the snapshot in the playground with a playground ID add it after the snapshot query string:

https://playground.babylonjs.com/?snapshot=refs/pull/19079/merge#BCU1XR#0

If you made changes to the sandbox or playground in this PR, additional comments will be generated soon containing links to the dev versions of those tools.

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

You have made possible changes to the playground.
You can test the snapshot here:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/19079/merge/

The snapshot playground with the CDN snapshot (only when available):

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/19079/merge/?snapshot=refs/pull/19079/merge

Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly.

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

⚡ Performance Test Results

🟢 All performance tests passed — no regressions detected.

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

You have changed file(s) that made possible changes to the sandbox.
You can test the sandbox snapshot here:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/19079/merge/

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

🟢 Memory Leak Test Results

4 passed, 0 leaked out of 4 scenarios

🟢 All memory leak tests passed — no leaks detected.

Passed Scenarios (4)
Scenario Package
Core Playground #2FDQT5#1508 @babylonjs/core
Core Playground #T90MQ4#14 @babylonjs/core
Core Playground #8EDB5N#2 @babylonjs/core
Core Playground #LL5BIQ#636 @babylonjs/core

@Popov72 Popov72 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make physics discovery linear in the number of bodies and constraints; the current repeated scans run even with visualization disabled. The property links also need to track world-index changes when an earlier world is removed. Both issues are detailed inline.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Reviewer - this PR has made changes to one or more package.json files.

@deltakosh deltakosh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ryantrem,

The mass-edit safeguards, the explicit thin-instance omission, and the complete constraint-helper tracking (including arrowheads) address my previous requests.

Thanks!

@ryantrem
ryantrem requested a review from Popov72 October 29, 2026 17:01
@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

You have changed file(s) that made possible changes to the sandbox.
You can test the sandbox snapshot here:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/19079/merge/

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

You have made possible changes to the playground.
You can test the snapshot here:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/19079/merge/

The snapshot playground with the CDN snapshot (only when available):

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/19079/merge/?snapshot=refs/pull/19079/merge

Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly.

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

⚡ Performance Test Results

🟢 All performance tests passed — no regressions detected.

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

🟢 Memory Leak Test Results

4 passed, 0 leaked out of 4 scenarios

🟢 All memory leak tests passed — no leaks detected.

Passed Scenarios (4)
Scenario Package
Core Playground #2FDQT5#1508 @babylonjs/core
Core Playground #T90MQ4#14 @babylonjs/core
Core Playground #8EDB5N#2 @babylonjs/core
Core Playground #LL5BIQ#636 @babylonjs/core

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

@Popov72 Popov72 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request substantial changes. The complete current-head post-fix review verified both prior corrections and found two medium-severity blocking debug-viewer performance issues and one low-severity nonblocking label update issue. All three are detailed inline.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Reviewer - this PR has made changes to one or more package.json files.

@deltakosh deltakosh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ryantrem,

The fixture visibility changes are test and readme only, and the new integration test covers the helpers staying in view. Still good to go.

Thanks!

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

You have changed file(s) that made possible changes to the sandbox.
You can test the sandbox snapshot here:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/19079/merge/

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

You have made possible changes to the playground.
You can test the snapshot here:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/19079/merge/

The snapshot playground with the CDN snapshot (only when available):

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/19079/merge/?snapshot=refs/pull/19079/merge

Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly.

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

⚡ Performance Test Results

🟢 All performance tests passed — no regressions detected.

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Capture per-world physics membership once per refresh, batch constraint helper mesh tracking per world, and refresh the world properties scene label on rename.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Reviewer - this PR has made changes to one or more package.json files.

@deltakosh deltakosh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ryantrem,

The linear membership capture and batched constraint-helper tracking keep the earlier safeguards (mass-edit checks, thin-body omission, arrowhead tracking) intact. Still good to go.

Thanks!

@Popov72 Popov72 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request substantial changes. The complete current-head post-fix review verified the prior corrections and found one blocking rejected-input restoration/retry issue, detailed inline.

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

You have changed file(s) that made possible changes to the sandbox.
You can test the sandbox snapshot here:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/19079/merge/

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

You have made possible changes to the playground.
You can test the snapshot here:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/19079/merge/

The snapshot playground with the CDN snapshot (only when available):

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/19079/merge/?snapshot=refs/pull/19079/merge

Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly.

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

🟢 Memory Leak Test Results

4 passed, 0 leaked out of 4 scenarios

🟢 All memory leak tests passed — no leaks detected.

Passed Scenarios (4)
Scenario Package
Core Playground #2FDQT5#1508 @babylonjs/core
Core Playground #T90MQ4#14 @babylonjs/core
Core Playground #8EDB5N#2 @babylonjs/core
Core Playground #LL5BIQ#636 @babylonjs/core

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

⚡ Performance Test Results

🟢 All performance tests passed — no regressions detected.

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Reviewer - this PR has made changes to one or more package.json files.

@ryantrem
ryantrem marked this pull request as draft October 29, 2026 21:55
@ryantrem

Copy link
Copy Markdown
Member Author

Converting to draft for now while I investigate what looks like a utility layer bug in Lite.

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

You have made possible changes to the playground.
You can test the snapshot here:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/19079/merge/

The snapshot playground with the CDN snapshot (only when available):

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/19079/merge/?snapshot=refs/pull/19079/merge

Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly.

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

You have changed file(s) that made possible changes to the sandbox.
You can test the sandbox snapshot here:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/19079/merge/

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

⚡ Performance Test Results

🟢 All performance tests passed — no regressions detected.

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

🟢 Memory Leak Test Results

4 passed, 0 leaked out of 4 scenarios

🟢 All memory leak tests passed — no leaks detected.

Passed Scenarios (4)
Scenario Package
Core Playground #2FDQT5#1508 @babylonjs/core
Core Playground #T90MQ4#14 @babylonjs/core
Core Playground #8EDB5N#2 @babylonjs/core
Core Playground #LL5BIQ#636 @babylonjs/core

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants