-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
Added wakeup to 2D and 3D body impulse and force functions. #53113
Conversation
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 porting this fix to 3.x!
These calls should be in PhysicsDirectBodyStateSW
class instead of BodySW
I know it's a bit confusing, but the direct body state is what users call directly, while BodySW API is used internally in the physics engine, so it would be overkill to activate the body in this API.
Here's where the direct body state calls for forces and impulses are in 2D for example:
godot/servers/physics_2d/body_2d_sw.h
Lines 368 to 373 in 29b1d39
virtual void add_central_force(const Vector2 &p_force) { body->add_central_force(p_force); } | |
virtual void add_force(const Vector2 &p_offset, const Vector2 &p_force) { body->add_force(p_offset, p_force); } | |
virtual void add_torque(real_t p_torque) { body->add_torque(p_torque); } | |
virtual void apply_central_impulse(const Vector2 &p_impulse) { body->apply_central_impulse(p_impulse); } | |
virtual void apply_impulse(const Vector2 &p_offset, const Vector2 &p_force) { body->apply_impulse(p_offset, p_force); } | |
virtual void apply_torque_impulse(real_t p_torque) { body->apply_torque_impulse(p_torque); } |
As a note, I'm also removing the 3.3 cherry-pick. This change is generally safe for 3.x, but since it might introduce minor changes in behavior in specific cases, better go through a slower validation process so we can make sure there's no regression. |
Ahh my bad! lots to learn. |
Have amended to wakeup on exposed API functions instead. |
Also I realised I didn't use the wakeup() functions on the equivalent master branch PR. instead I directly used set_active(). Should I change that to also use wakeup()? |
Oh, good point, I missed that on the master version. It looks like |
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.
Looks great!
Thanks! |
Wake sleeping bodies on apply force and impulse functions.
Bugsquad edit:
3.x
version of #52967.