-
-
Notifications
You must be signed in to change notification settings - Fork 309
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
Support destroy physicsMaterial #2481
base: dev/1.4
Are you sure you want to change the base?
Conversation
WalkthroughThe changes involve modifying the Changes
Suggested Reviewers
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/core/src/physics/PhysicsMaterial.ts (1)
100-100
: Correct the docstring to enhance clarity."Destroy the material when the material is no be used by any shape." → Consider changing it to "Destroy the material when it is no longer used by any shape." for improved readability and clarity.
/** - * Destroy the material when the material is no be used by any shape. + * Destroy the material when it is no longer used by any shape. */tests/src/core/physics/PhysicsMaterial.test.ts (1)
490-496
: Improve test coverage with repeated destroy calls.This test correctly verifies that the material can no longer be manipulated after destruction. Consider adding a scenario in which
destroy()
is called multiple times to ensure the method remains idempotent and no errors occur on subsequent calls.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/core/src/physics/PhysicsMaterial.ts
(1 hunks)tests/src/core/physics/PhysicsMaterial.test.ts
(1 hunks)
🔇 Additional comments (1)
packages/core/src/physics/PhysicsMaterial.ts (1)
102-102
: Implementation logic looks good.
The null-check-style pattern using !this._destroyed
is concise and ensures that the native material’s destruction is idempotent. This public method is a welcomed improvement over the previous _destroy()
method and should not introduce breaking changes.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev/1.4 #2481 +/- ##
===========================================
- Coverage 68.42% 68.40% -0.03%
===========================================
Files 923 923
Lines 95940 95928 -12
Branches 8140 8139 -1
===========================================
- Hits 65647 65618 -29
- Misses 30040 30056 +16
- Partials 253 254 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
What is the current behavior? (You can also link to an open issue here)
What is the new behavior (if this is a feature change)?
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
Other information:
Summary by CodeRabbit
New Features
Bug Fixes
Tests
destroy
method in thePhysicsMaterial
test suite to verify correct behavior post-destruction.