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

PhysicsMaterial support destroy #2481

Merged
merged 25 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5b7e72e
test: fix ci
luzhuang Nov 18, 2024
345dcd2
Merge branch dev/1.4 of github.com:oasis-engine/engine into dev/1.4
luzhuang Dec 3, 2024
0874ae0
feat: support get contract points and get closest point on shape from…
luzhuang Dec 12, 2024
3d21a10
refactor: opt code
luzhuang Dec 12, 2024
308b918
refactor: opt code
luzhuang Dec 13, 2024
2385d0e
test: add ut
luzhuang Dec 16, 2024
1b8c7e5
refactor: opt code
luzhuang Dec 17, 2024
3f5009a
refactor: opt code
luzhuang Dec 18, 2024
180f6d3
refactor: opt code
luzhuang Dec 18, 2024
bda087f
refactor: opt code
luzhuang Dec 18, 2024
9c4298b
refactor: opt code
luzhuang Dec 18, 2024
3801a63
refactor: opt code
luzhuang Dec 18, 2024
89d166a
refactor: opt code
luzhuang Dec 18, 2024
8ac3ea2
refactor: opt code
luzhuang Dec 18, 2024
7c5b4c9
refactor: opt code
luzhuang Dec 18, 2024
b97b6ac
fix: lite closest point error when point internal
luzhuang Dec 19, 2024
fb77cfc
Merge branch dev/1.4 of github.com:oasis-engine/engine into feat/cont…
luzhuang Dec 19, 2024
71bca27
fix: lite closest point error when point internal
luzhuang Dec 20, 2024
9d1beb0
Merge branch dev/1.4 of github.com:oasis-engine/engine into feat/cont…
luzhuang Dec 20, 2024
6eb9d5c
feat: add physicsMaterial loader and joint component parser
luzhuang Dec 24, 2024
38ec5f4
Merge branch 'dev/1.4' of github.com:oasis-engine/engine into feat/ph…
luzhuang Dec 24, 2024
0bf35ec
refactor: opt code
luzhuang Dec 24, 2024
7d3c49e
refactor: opt code
luzhuang Dec 24, 2024
ca062bf
feat: support destroy physicsMaterial
luzhuang Dec 27, 2024
ac34ad0
Merge branch 'dev/1.4' of github.com:oasis-engine/engine into feat/ph…
luzhuang Dec 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/core/src/physics/PhysicsMaterial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ export class PhysicsMaterial {
}

/**
* @internal
* Destroy the material when the material is no be used by any shape.
*/
_destroy() {
destroy() {
!this._destroyed && this._nativeMaterial.destroy();
this._destroyed = true;
}
Expand Down
8 changes: 8 additions & 0 deletions tests/src/core/physics/PhysicsMaterial.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,4 +486,12 @@ describe("PhysicsMaterial", () => {
engine.sceneManager.activeScene.physics._update(1);
expect(formatValue(boxEntity2.transform.position.z)).eq(0.57139);
});

it("destroy", () => {
const physicsMaterial = new PhysicsMaterial();
physicsMaterial.destroy();
expect(() => {
physicsMaterial.bounciness = 1;
}).toThrowError();
});
});
Loading