summaryrefslogtreecommitdiff
path: root/doc/classes
diff options
context:
space:
mode:
authorPouleyKetchoupp <pouleyketchoup@gmail.com>2021-06-17 18:09:40 -0700
committerPouleyKetchoupp <pouleyketchoup@gmail.com>2021-06-30 09:20:44 -0700
commit5cbdc7a0acbefcc3aa3cb0eb0fe05b5b10fe7370 (patch)
treeed92cd22587c8e8bf235e5b08b6017b5a5e8ca70 /doc/classes
parent92f20fd70e6957cd65ccb7837fdc28f9b1e4a315 (diff)
Add support for controlling physics nodes' behavior when disabled
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.
Diffstat (limited to 'doc/classes')
-rw-r--r--doc/classes/CollisionObject2D.xml14
-rw-r--r--doc/classes/CollisionObject3D.xml14
-rw-r--r--doc/classes/Node.xml6
-rw-r--r--doc/classes/SoftBody3D.xml10
4 files changed, 44 insertions, 0 deletions
diff --git a/doc/classes/CollisionObject2D.xml b/doc/classes/CollisionObject2D.xml
index 7c4c75bf0f..e96124c9eb 100644
--- a/doc/classes/CollisionObject2D.xml
+++ b/doc/classes/CollisionObject2D.xml
@@ -266,6 +266,9 @@
The physics layers this CollisionObject2D scans. Collision objects can scan one or more of 32 different layers. See also [member collision_layer].
[b]Note:[/b] A contact is detected if object A is in any of the layers that object B scans, or object B is in any layers that object A scans. See [url=https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information.
</member>
+ <member name="disable_mode" type="int" setter="set_disable_mode" getter="get_disable_mode" enum="CollisionObject2D.DisableMode" default="0">
+ Defines the behavior in physics when [member Node.process_mode] is set to [constant Node.PROCESS_MODE_DISABLED]. See [enum DisableMode] for more details about the different modes.
+ </member>
<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>
@@ -294,5 +297,16 @@
</signal>
</signals>
<constants>
+ <constant name="DISABLE_MODE_REMOVE" value="0" enum="DisableMode">
+ When [member Node.process_mode] is set to [constant Node.PROCESS_MODE_DISABLED], remove from the physics simulation to stop all physics interactions with this [CollisionObject2D].
+ Automatically re-added to the physics simulation when the [Node] is processed again.
+ </constant>
+ <constant name="DISABLE_MODE_MAKE_STATIC" value="1" enum="DisableMode">
+ When [member Node.process_mode] is set to [constant Node.PROCESS_MODE_DISABLED], make the body static. Doesn't affect [Area2D]. [PhysicsBody2D] can't be affected by forces or other bodies while static.
+ Automatically set [PhysicsBody2D] back to its original mode when the [Node] is processed again.
+ </constant>
+ <constant name="DISABLE_MODE_KEEP_ACTIVE" value="2" enum="DisableMode">
+ When [member Node.process_mode] is set to [constant Node.PROCESS_MODE_DISABLED], do not affect the physics simulation.
+ </constant>
</constants>
</class>
diff --git a/doc/classes/CollisionObject3D.xml b/doc/classes/CollisionObject3D.xml
index 4ab37f5c7b..dfd1e85e56 100644
--- a/doc/classes/CollisionObject3D.xml
+++ b/doc/classes/CollisionObject3D.xml
@@ -230,6 +230,9 @@
The physics layers this CollisionObject3D scans. Collision objects can scan one or more of 32 different layers. See also [member collision_layer].
[b]Note:[/b] A contact is detected if object A is in any of the layers that object B scans, or object B is in any layers that object A scans. See [url=https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information.
</member>
+ <member name="disable_mode" type="int" setter="set_disable_mode" getter="get_disable_mode" enum="CollisionObject3D.DisableMode" default="0">
+ Defines the behavior in physics when [member Node.process_mode] is set to [constant Node.PROCESS_MODE_DISABLED]. See [enum DisableMode] for more details about the different modes.
+ </member>
<member name="input_capture_on_drag" type="bool" setter="set_capture_input_on_drag" getter="get_capture_input_on_drag" default="false">
If [code]true[/code], the [CollisionObject3D] will continue to receive input events as the mouse is dragged across its shapes.
</member>
@@ -265,5 +268,16 @@
</signal>
</signals>
<constants>
+ <constant name="DISABLE_MODE_REMOVE" value="0" enum="DisableMode">
+ When [member Node.process_mode] is set to [constant Node.PROCESS_MODE_DISABLED], remove from the physics simulation to stop all physics interactions with this [CollisionObject3D].
+ Automatically re-added to the physics simulation when the [Node] is processed again.
+ </constant>
+ <constant name="DISABLE_MODE_MAKE_STATIC" value="1" enum="DisableMode">
+ When [member Node.process_mode] is set to [constant Node.PROCESS_MODE_DISABLED], make the body static. Doesn't affect [Area2D]. [PhysicsBody3D] can't be affected by forces or other bodies while static.
+ Automatically set [PhysicsBody3D] back to its original mode when the [Node] is processed again.
+ </constant>
+ <constant name="DISABLE_MODE_KEEP_ACTIVE" value="2" enum="DisableMode">
+ When [member Node.process_mode] is set to [constant Node.PROCESS_MODE_DISABLED], do not affect the physics simulation.
+ </constant>
</constants>
</class>
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml
index a9c38e4d06..7a9cb702e3 100644
--- a/doc/classes/Node.xml
+++ b/doc/classes/Node.xml
@@ -894,6 +894,12 @@
<constant name="NOTIFICATION_POST_ENTER_TREE" value="27">
Notification received when the node is ready, just before [constant NOTIFICATION_READY] is received. Unlike the latter, it's sent every time the node enters tree, instead of only once.
</constant>
+ <constant name="NOTIFICATION_DISABLED" value="28">
+ Notification received when the node is disabled. See [constant PROCESS_MODE_DISABLED].
+ </constant>
+ <constant name="NOTIFICATION_ENABLED" value="29">
+ Notification received when the node is enabled again after being disabled. See [constant PROCESS_MODE_DISABLED].
+ </constant>
<constant name="NOTIFICATION_EDITOR_PRE_SAVE" value="9001">
Notification received right before the scene with the node is saved in the editor. This notification is only sent in the Godot editor and will not occur in exported projects.
</constant>
diff --git a/doc/classes/SoftBody3D.xml b/doc/classes/SoftBody3D.xml
index 7999ad774d..b143c60d9d 100644
--- a/doc/classes/SoftBody3D.xml
+++ b/doc/classes/SoftBody3D.xml
@@ -93,6 +93,9 @@
</member>
<member name="damping_coefficient" type="float" setter="set_damping_coefficient" getter="get_damping_coefficient" default="0.01">
</member>
+ <member name="disable_mode" type="int" setter="set_disable_mode" getter="get_disable_mode" enum="SoftBody3D.DisableMode" default="0">
+ Defines the behavior in physics when [member Node.process_mode] is set to [constant Node.PROCESS_MODE_DISABLED]. See [enum DisableMode] for more details about the different modes.
+ </member>
<member name="drag_coefficient" type="float" setter="set_drag_coefficient" getter="get_drag_coefficient" default="0.0">
</member>
<member name="linear_stiffness" type="float" setter="set_linear_stiffness" getter="get_linear_stiffness" default="0.5">
@@ -113,5 +116,12 @@
</member>
</members>
<constants>
+ <constant name="DISABLE_MODE_REMOVE" value="0" enum="DisableMode">
+ When [member Node.process_mode] is set to [constant Node.PROCESS_MODE_DISABLED], remove from the physics simulation to stop all physics interactions with this [SoftBody3D].
+ Automatically re-added to the physics simulation when the [Node] is processed again.
+ </constant>
+ <constant name="DISABLE_MODE_KEEP_ACTIVE" value="1" enum="DisableMode">
+ When [member Node.process_mode] is set to [constant Node.PROCESS_MODE_DISABLED], do not affect the physics simulation.
+ </constant>
</constants>
</class>