-
-
Notifications
You must be signed in to change notification settings - Fork 21.8k
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
Add support for controlling physics nodes' behavior when disabled #49834
Add support for controlling physics nodes' behavior when disabled #49834
Conversation
This needs more docs. What does "remove from simulation" mean? can they be readded? |
They are automatically re-added when the node is enabled again. I'll update the doc to make it clear. |
027d70f
to
b0b397c
Compare
doc/classes/CollisionObject2D.xml
Outdated
@@ -269,6 +269,9 @@ | |||
<member name="input_pickable" type="bool" setter="set_pickable" getter="is_pickable" default="true"> | |||
If [code]true[/code], this object is pickable. A pickable object can detect the mouse pointer entering/leaving, and if the mouse is inside it, report input events. Requires at least one [code]collision_layer[/code] bit to be set. | |||
</member> | |||
<member name="on_disable" type="int" setter="set_on_disable" getter="get_on_disable" enum="CollisionObject2D.DisableMode" default="0"> |
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.
Wouldn't disable_mode
be a clearer name? on_disable
sounds like a signal callback.
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 second disable_mode probably being best
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.
Yes, this name does sound better! Just pushed with this change.
b0b397c
to
cf3a9f4
Compare
New property disable_mode to set different behaviors: Remove: remove from physics simulation MakeStatic: change body mode to static (doesn't affect area and soft body) KeepActive: do nothing Extra change: Handle disable/enable node state with specific notifications, in order to differentiate global pause from disabled nodes.
cf3a9f4
to
5cbdc7a
Compare
Thanks! |
New property
on_disable
disable_mode
inCollisionObject2D
andCollisionObject3D
to set different behaviors when processing is disabled:Remove
: remove from physics simulationMakeStatic
: change body mode to static (doesn't affect area and soft body)KeepActive
: do nothingSame property on
SoftBody3D
with onlyRemove
andKeepActive
modes.Extra change in
Node
:Handle disable/enable node state with specific notifications, in order to differentiate global pause from disabled nodes.
Implements godotengine/godot-proposals#2843
Supersedes #46921