-
-
Notifications
You must be signed in to change notification settings - Fork 253
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
Improve capacity handling for ColliderSet
, RigidBodySet
.
#726
Conversation
These allow an application to reduce the cost of reallocation when they know that a large number of colliders or rigid bodies will be created.
We may at times create a scene with a large number of colliders and prefer that doing so be fast. (In our case, we're not running physics or rigid bodies. We're also able to disable the colliders as we don't need the full collision detection, just answers to queries.) For a silly test case of 8,000,000 (200x200x200) things (using There's a number of questions that could be considered here beyond just these changes:
|
@Vrixyz @sebcrozet Just checking in on this... |
@@ -5,6 +5,10 @@ | |||
- The region key has been replaced by an i64 in the f64 version of rapier, increasing the range before panics occur. | |||
- Fix `BroadphaseMultiSap` not being able to serialize correctly with serde_json. | |||
|
|||
### Added | |||
|
|||
- `RigidBodySet` and `ColliderSet` have a new constructor `with_capacity`. |
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.
Should this point to this PR?
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.
Ideally yes, but it's rare to have the PR link, I'm adding it arbitrarily on bigger/breaking/difficult PRs
I'll merge this as-is ; as for your questions,
A good idea.
If there's a real use case for it, I'd approve it, but probably pass in the exact values of each properties, so each properties can be tweaked ?
Probably a good idea, but I'd prefer a real use case too. |
My concern here is that you add a ton of things, so the storage gets really big, but after that, there's only a few modified per frame, so most of that storage is wasted. This isn't new with my changes, but just thinking about the overall impact of everything in this area... |
These allow an application to reduce the cost of reallocation when they know that a large number of colliders or rigid bodies will be created.