-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Optimization of Collision Group Script #984
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
Conversation
…ction for Improved Performance I've optimized the script for handling collision groups in Roblox. The main change involves removing the connection to DescendantAdded, applying the collision group immediately to all parts in the model upon character addition. This reduces unnecessary event connections, improving performance by applying the collision group once for all descendants, rather than repeatedly when new parts are added. This should help improve game performance, especially when handling many parts or players.
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.
Hi @Lucatacos, thanks so much for helping improve the Roblox creator documentation! Our technical writing team will review your pull request soon. In the meantime, please ensure you've read through the README.md, contribution guidelines, and style recommendations.
|
I was initially a bit concerned by this change, in that all of the character BaseParts wouldn't be loaded in by the time CharacterAdded fires, but all of the collision-prone parts should be loaded at this point. If you detect otherwise in any future testing, please file another PR to restore the DescendantAdded bit which would account for any BaseParts added after the CharacterAdded event. Thanks! |
|
FYI, I also removed the |
…mple Reverting my change (Roblox#984) because the original example is clearer and handles all cases better. It properly sets collision groups for parts added after the character spawns, which my version didn’t cover. This makes the official documentation more complete and easier to understand. Regarding performance, the difference is minimal for most use cases, but the original version is safer as it handles dynamic parts correctly without impacting performance noticeably.
…mple Reverting my change (Roblox#984) because the original example is clearer and handles all cases better. It properly sets collision groups for parts added after the character spawns, which my version didn’t cover. This makes the official documentation more complete and easier to understand. Regarding performance, the difference is minimal for most use cases, but the original version is safer as it handles dynamic parts correctly without impacting performance noticeably
…mple (#1196) ## Changes Reverting my change (#984) because the original example is clearer and handles all cases better. It properly sets collision groups for parts added after the character spawns, which my version didn’t cover. This makes the official documentation more complete and easier to understand. Regarding performance, the difference is minimal for most use cases, but the original version is safer as it handles dynamic parts correctly without impacting performance noticeably ## Checks By submitting your pull request for review, you agree to the following: - [ ] This contribution was created in whole or in part by me, and I have the right to submit it under the terms of this repository's open source licenses. - [ ] I understand and agree that this contribution and a record of it are public, maintained indefinitely, and may be redistributed under the terms of this repository's open source licenses. - [ ] To the best of my knowledge, all proposed changes are accurate.
Changes
I've optimized the script for handling collision groups in Roblox. The main change involves removing the connection to DescendantAdded, applying the collision group immediately to all parts in the model upon character addition. This reduces unnecessary event connections, improving performance by applying the collision group once for all descendants, rather than repeatedly when new parts are added. This should help improve game performance, especially when handling many parts or players.
Checks
By submitting your pull request for review, you agree to the following: