-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
[3.2] Optimized physics object spawn time #40188
[3.2] Optimized physics object spawn time #40188
Conversation
7a7d2f1
to
b72e70a
Compare
FYI, when cherry-picking commits I prefer using |
I'll keep that in mind for next time. If the changes conflict too much, a lot of the time I just try to get through the conflict resolution tool as soon as possible, then I fix the code manually and squash. Perhaps it's not the best approach :P |
Yeah I don't use any conflict resolution tool or strategy myself, I just open all conflicting files in |
Backported from pull request 39726 from AndreaCatania/add_body_impr_physics Co-authored-by: Andrea Catania <[email protected]>
b72e70a
to
47c195d
Compare
- Flushing Areas before anything else. - Make sure to correctly fetch gravity when the integrate_forces function is used - Lazy reload body when layer and mask changes - Shapes are reloaded just before the physics step starts. - Improved some other parts of the code. - Added override keyword f
and add RigidBodyCollisionObjectBullet to flush queue when a shape reload is needed.
47c195d
to
24d50fd
Compare
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.
Thanks for this PR, just few things to change.
need_shape_reload = true; | ||
if (space) { | ||
space->add_to_flush_queue(this); | ||
} |
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.
The shape should not be reloaded during the flush but during the pre_process. To fix the issue #40840 you need to insert p_body->pre_process();
at the beginning of the function test_body_motion
.
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.
I don't understand what you mean. I already added p_body->pre_process();
in test_body_motion
on the line you mentioned in this comment #40886 (comment) (see 24d50fd#diff-a61d01bcaef4874b6713c0b00e6d4571R1014)
} | ||
} | ||
|
||
void RigidBodyBullet::dispatch_callbacks() { | ||
RigidCollisionObjectBullet::dispatch_callbacks(); |
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.
This is not needed. Check this: #40886 (comment)
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.
So you want me to delete the call to RigidCollisionObjectBullet::dispatch_callbacks()
inside of RigidBodyBullet::dispatch_callbacks()
? I don't understand what that comment has to do with this line.
Would be nice port |
If we need to add core engine features to backport this feature, then it might be better to just not backport this, and simply require that people wait for 4.0 if they want improved physics object spawn times. |
Port Feel free to do it, or not. |
Because of the numerous regressions caused by #39726, #40252, and maybe others, I'm closing this. It would have been nice to have in 3.2, since it significantly improves performance in the Voxel demo, but there are just too many regressions. I'm just going to make a blanket statement that the dumpster fire known as Godot's physics is far too risky to take cherry-picks from, and from now on I would suggest all physics changes be kept as 4.0+ only. |
After all the work done here, I would not close this. But well, is up to you I think. |
Backported to 3.2 from pull request #39726 from AndreaCatania/add_body_impr_physics
Tested on the Voxel demo project from the Godot demo projects repo.