Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhysicsPlugin refactor #13279

Merged
merged 28 commits into from
Dec 7, 2022
Merged

PhysicsPlugin refactor #13279

merged 28 commits into from
Dec 7, 2022

Conversation

CedricGuillemet
Copy link
Contributor

@CedricGuillemet CedricGuillemet commented Nov 23, 2022

Goal of this PR: move physics to v1, add v2 folder. keep existing working (back compat).

All current physics moved to physics/v1. New stuff in physics/v2. Shared things are in physics/

  • v1 and v2 have different names (body/shape/material/constraint in V2 and impostor/joint in V1) and different concepts
  • Have an helper PhysicsAggregate that will contain a body, a material and a shape that can be created by 1 call (just like existing v1)

On the Babylon side, Material, shape, body are opaque proxies. Real work is done in the plugin. Plugin stores its references thanks to public _pluginData: any = undefined;

PhysicsViewer, mesh,....still using v1.

Tested with PG from documentation and PhysicsDebug Viewer.

@azure-pipelines
Copy link

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.

@azure-pipelines
Copy link

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.

@azure-pipelines
Copy link

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.

@azure-pipelines
Copy link

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.

@azure-pipelines
Copy link

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.

@azure-pipelines
Copy link

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.

@azure-pipelines
Copy link

@azure-pipelines
Copy link

Visualization tests for webgl2 have failed. If some tests failed because the snapshots do not match, the report can be found at

https://babylonsnapshots.z22.web.core.windows.net/refs/pull/13279/merge/testResults/webgl2/index.html

If tests were successful afterwards, this report might not be available anymore.

@CedricGuillemet CedricGuillemet marked this pull request as ready for review November 29, 2022 13:36
Copy link
Member

@RaananW RaananW left a comment

Choose a reason for hiding this comment

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

I'll review it fully tomorrow morning. The first thing I noticed - there is no need to add V1 or V2 to the exported modules. Importing the right ones from the right directory will be enough when developing core. for UMD users there will be a conflict if they are named the same. For that you can use export A as B, similar to the way this is exported:

https://github.com/BabylonJS/Babylon.js/blob/master/packages/dev/gui/src/3D/controls/index.ts#L24

packages/dev/core/src/Physics/IPhysicsEngine.ts Outdated Show resolved Hide resolved
packages/dev/core/src/Physics/physicsEngineComponent.ts Outdated Show resolved Hide resolved
packages/dev/core/src/Physics/v1/Plugins/cannonJSPlugin.ts Outdated Show resolved Hide resolved
packages/dev/core/src/Physics/v2/IPhysicsEnginePluginV2.ts Outdated Show resolved Hide resolved
packages/dev/core/src/Physics/v2/IPhysicsEnginePluginV2.ts Outdated Show resolved Hide resolved
packages/dev/core/src/Physics/v2/physicsEngineV2.ts Outdated Show resolved Hide resolved
packages/dev/core/src/Physics/v2/IPhysicsEnginePluginV2.ts Outdated Show resolved Hide resolved
packages/dev/core/src/Physics/v2/physicsShape.ts Outdated Show resolved Hide resolved
packages/dev/core/src/Physics/v2/physicsShape.ts Outdated Show resolved Hide resolved
@sebavan
Copy link
Member

sebavan commented Dec 2, 2022

Before I deep dive in the PR, the main question is how big of a breaking change it is for the existing users both UMD and ES6 users ?

@CedricGuillemet
Copy link
Contributor Author

Before I deep dive in the PR, the main question is how big of a breaking change it is for the existing users both UMD and ES6 users ?

This is a question for @RaananW as I don't want to say incorrect things

@sebavan
Copy link
Member

sebavan commented Dec 5, 2022

@RaananW any update on the back compat ?

@RaananW
Copy link
Member

RaananW commented Dec 5, 2022

Sorry! totally missed the question.

Yes, this is a breaking change for the es6 users, since the files have moved.
We can fix it by placing proxy files that export from the right places (but are not exported in any index.ts). this way we solve the issue after moving it. does it make sense?

Of course, another solution is to only have a v2 folder and move the v1 files back to their original position.

@sebavan
Copy link
Member

sebavan commented Dec 5, 2022

@RaananW and @CedricGuillemet, I let you chose as I do not have any preferences but would like one or the other if possible :-)

@CedricGuillemet CedricGuillemet merged commit 0466481 into BabylonJS:master Dec 7, 2022
RaananW pushed a commit that referenced this pull request Dec 9, 2022
PhysicsPlugin refactor

Former-commit-id: 9578993bf8e3848348877d632a053f0b18e0c281
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants