Skip to content

Allow disabling Havok floating origin world regions - #18750

Merged
sebavan merged 1 commit into
BabylonJS:masterfrom
BarthPaleologue:feat/havok-disable-world-regions
Jul 31, 2026
Merged

Allow disabling Havok floating origin world regions#18750
sebavan merged 1 commit into
BabylonJS:masterfrom
BarthPaleologue:feat/havok-disable-world-regions

Conversation

@BarthPaleologue

Copy link
Copy Markdown
Contributor

Hey there,

I have been toying with havok world regions recently, and learned there is no perfect solution for physics handling in large scale worlds.

World regions have edge cases around world migrations (2 bodies close in space should interact but are in fact in 2 separate worlds like in this PG), origin rebasing only works when physics happen close to the camera and double precision has a performance and memory hit (although I saw Jolt only uses f64 for positions to limit the penalty to ~10% jrouwe/JoltPhysics#94 (comment)).

So my point is Babylon should let havok users make their own large world implementation if they want to.

Hence this small PR adds a config flag to disable havok world regions even when floating origin is enabled.

Let me know how you feel about it!

@georginahalpern

georginahalpern commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

@BarthPaleologue what if you set the floatingOriginWorldRadius to infinity or to a number representing the size of your world? would that achieve the same behavior without adding additional flags ?

Comment thread packages/dev/core/src/Physics/v2/Plugins/havokPlugin.ts
@sebavan

sebavan commented Jul 29, 2026

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@CedricGuillemet

Copy link
Copy Markdown
Contributor

I agree with @georginahalpern . setting a very large physics world size should solve the issue.

@bjsplat

bjsplat commented Jul 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 Jul 29, 2026

Copy link
Copy Markdown
Collaborator

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

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

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

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/18750/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/18750/merge
https://sandbox.babylonjs.com/?snapshot=refs/pull/18750/merge
https://gui.babylonjs.com/?snapshot=refs/pull/18750/merge
https://nme.babylonjs.com/?snapshot=refs/pull/18750/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/18750/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 Jul 29, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

⚡ Performance Test Results

🟢 All performance tests passed — no regressions detected.

@bjsplat

bjsplat commented Jul 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 Jul 29, 2026

Copy link
Copy Markdown
Collaborator

@sebavan
sebavan enabled auto-merge (squash) July 29, 2026 20:50
@sebavan
sebavan merged commit e92a645 into BabylonJS:master Jul 31, 2026
21 checks passed
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