Skip to content
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

Change physics disabled booleans to enabled #44141

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 49 additions & 44 deletions doc/classes/CollisionObject2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
<argument index="2" name="shape_idx" type="int">
</argument>
<description>
Accepts unhandled [InputEvent]s. Requires [member input_pickable] to be [code]true[/code]. [code]shape_idx[/code] is the child index of the clicked [Shape2D]. Connect to the [code]input_event[/code] signal to easily pick up these events.
madmiraal marked this conversation as resolved.
Show resolved Hide resolved
Accepts unhandled [InputEvent]s. Connect to the [signal input_event] signal to easily pick up these events. [code]shape_idx[/code] is the index of the [Shape2D].
[b]Note:[/b] Requires [member input_pickable] to be [code]true[/code].
</description>
</method>
<method name="create_shape_owner">
Expand All @@ -31,6 +32,17 @@
Creates a new shape owner for the given object. Returns [code]owner_id[/code] of the new owner for future reference.
</description>
</method>
<method name="enable_shape_owner">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be a bit clearer to call this method set_shape_owner_enabled since it can be used to disable as well. It can be a simple setter, without the default value.

<return type="void">
</return>
<argument index="0" name="owner_id" type="int">
</argument>
<argument index="1" name="enable" type="bool" default="true">
</argument>
<description>
Enables the shape owner with the specified [code]owner_id[/code] and all its shapes.
</description>
</method>
<method name="get_collision_layer_bit" qualifiers="const">
<return type="bool">
</return>
Expand All @@ -56,38 +68,20 @@
Returns the object's [RID].
</description>
</method>
<method name="get_shape_owner_one_way_collision_margin" qualifiers="const">
<return type="float">
</return>
<argument index="0" name="owner_id" type="int">
</argument>
<description>
Returns the [code]one_way_collision_margin[/code] of the shape owner identified by given [code]owner_id[/code].
</description>
</method>
<method name="get_shape_owners">
<return type="Array">
</return>
<description>
Returns an [Array] of [code]owner_id[/code] identifiers. You can use these ids in other methods that take [code]owner_id[/code] as an argument.
</description>
</method>
<method name="is_shape_owner_disabled" qualifiers="const">
<method name="is_shape_owner_enabled" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="owner_id" type="int">
</argument>
<description>
If [code]true[/code], the shape owner and its shapes are disabled.
</description>
</method>
<method name="is_shape_owner_one_way_collision_enabled" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="owner_id" type="int">
</argument>
<description>
Returns [code]true[/code] if collisions for the shape owner originating from this [CollisionObject2D] will not be reported to collided with [CollisionObject2D]s.
Returns whether or not the shape owner with the specified [code]owner_id[/code] and all its shapes are enabled.
</description>
</method>
<method name="remove_shape_owner">
Expand Down Expand Up @@ -152,6 +146,26 @@
Removes all shapes from the shape owner.
</description>
</method>
<method name="shape_owner_enable_one_way_collision">
<return type="void">
</return>
<argument index="0" name="owner_id" type="int">
</argument>
<argument index="1" name="enable" type="bool" default="true">
</argument>
<description>
Enables the one-way collision property of the specified shape owner and all its shapes.
</description>
</method>
<method name="shape_owner_get_one_way_collision_margin" qualifiers="const">
<return type="float">
</return>
<argument index="0" name="owner_id" type="int">
</argument>
<description>
Returns the [code]one_way_collision_margin[/code] of the shape owner with the specified [code]owner_id[/code].
</description>
</method>
<method name="shape_owner_get_owner" qualifiers="const">
<return type="Object">
</return>
Expand Down Expand Up @@ -201,37 +215,24 @@
Returns the shape owner's [Transform2D].
</description>
</method>
<method name="shape_owner_remove_shape">
<return type="void">
</return>
<argument index="0" name="owner_id" type="int">
</argument>
<argument index="1" name="shape_id" type="int">
</argument>
<description>
Removes a shape from the given shape owner.
</description>
</method>
<method name="shape_owner_set_disabled">
<return type="void">
<method name="shape_owner_is_one_way_collision_enabled" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="owner_id" type="int">
</argument>
<argument index="1" name="disabled" type="bool">
</argument>
<description>
If [code]true[/code], disables the given shape owner.
Returns wether or not one-way collision property of the shape owner with the specified [code]owner_id[/code] is enabled.
</description>
</method>
<method name="shape_owner_set_one_way_collision">
<method name="shape_owner_remove_shape">
<return type="void">
</return>
<argument index="0" name="owner_id" type="int">
</argument>
<argument index="1" name="enable" type="bool">
<argument index="1" name="shape_id" type="int">
</argument>
<description>
If [code]enable[/code] is [code]true[/code], collisions for the shape owner originating from this [CollisionObject2D] will not be reported to collided with [CollisionObject2D]s.
Removes a shape from the given shape owner.
</description>
</method>
<method name="shape_owner_set_one_way_collision_margin">
Expand Down Expand Up @@ -267,7 +268,8 @@
[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="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.
If [code]true[/code], this object can trigger input events. A pickable object will detect the mouse pointer entering and leaving, and, while the mouse is on it, generate [InputEventMouse] events.
[b]Note:[/b] Requires at least one [code]collision_layer[/code] bit to be set.
</member>
</members>
<signals>
Expand All @@ -279,17 +281,20 @@
<argument index="2" name="shape_idx" type="int">
</argument>
<description>
Emitted when an input event occurs. Requires [member input_pickable] to be [code]true[/code] and at least one [code]collision_layer[/code] bit to be set. See [method _input_event] for details.
Emitted when the mouse is over any of this object's shapes. See [InputEventMouse] for [code]event[/code] details.
[b]Note:[/b] Requires [member input_pickable] to be [code]true[/code].
</description>
</signal>
<signal name="mouse_entered">
<description>
Emitted when the mouse pointer enters any of this object's shapes. Requires [member input_pickable] to be [code]true[/code] and at least one [code]collision_layer[/code] bit to be set.
Emitted when the mouse pointer enters any of this object's shapes.
[b]Note:[/b] Requires [member input_pickable] to be [code]true[/code].
</description>
</signal>
<signal name="mouse_exited">
<description>
Emitted when the mouse pointer exits all this object's shapes. Requires [member input_pickable] to be [code]true[/code] and at least one [code]collision_layer[/code] bit to be set.
Emitted when the mouse pointer exits all this object's shapes.
[b]Note:[/b] Requires [member input_pickable] to be [code]true[/code].
</description>
</signal>
</signals>
Expand Down
51 changes: 28 additions & 23 deletions doc/classes/CollisionObject3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
</argument>
<argument index="1" name="event" type="InputEvent">
</argument>
<argument index="2" name="click_position" type="Vector3">
<argument index="2" name="position" type="Vector3">
</argument>
<argument index="3" name="click_normal" type="Vector3">
<argument index="3" name="normal" type="Vector3">
</argument>
<argument index="4" name="shape_idx" type="int">
</argument>
<description>
Accepts unhandled [InputEvent]s. [code]click_position[/code] is the clicked location in world space and [code]click_normal[/code] is the normal vector extending from the clicked surface of the [Shape3D] at [code]shape_idx[/code]. Connect to the [code]input_event[/code] signal to easily pick up these events.
Accepts unhandled [InputEvent]s. Connect to the [signal input_event] signal to easily pick up these events.
[b]Note:[/b] Requires [member input_pickable] to be [code]true[/code].
</description>
</method>
<method name="create_shape_owner">
Expand All @@ -35,6 +36,17 @@
Creates a new shape owner for the given object. Returns [code]owner_id[/code] of the new owner for future reference.
</description>
</method>
<method name="enable_shape_owner">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for 3D.

<return type="void">
</return>
<argument index="0" name="owner_id" type="int">
</argument>
<argument index="1" name="enable" type="bool" default="true">
</argument>
<description>
Enables the shape owner with the specified [code]owner_id[/code] and all its shapes.
</description>
</method>
<method name="get_collision_layer_bit" qualifiers="const">
<return type="bool">
</return>
Expand Down Expand Up @@ -67,13 +79,13 @@
Returns an [Array] of [code]owner_id[/code] identifiers. You can use these ids in other methods that take [code]owner_id[/code] as an argument.
</description>
</method>
<method name="is_shape_owner_disabled" qualifiers="const">
<method name="is_shape_owner_enabled" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="owner_id" type="int">
</argument>
<description>
If [code]true[/code], the shape owner and its shapes are disabled.
Returns whether or not the shape owner with the specified [code]owner_id[/code] and all its shapes are enabled.
</description>
</method>
<method name="remove_shape_owner">
Expand Down Expand Up @@ -198,17 +210,6 @@
Removes a shape from the given shape owner.
</description>
</method>
<method name="shape_owner_set_disabled">
<return type="void">
</return>
<argument index="0" name="owner_id" type="int">
</argument>
<argument index="1" name="disabled" type="bool">
</argument>
<description>
If [code]true[/code], disables the given shape owner.
</description>
</method>
<method name="shape_owner_set_transform">
<return type="void">
</return>
Expand All @@ -230,11 +231,12 @@
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="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 name="input_capture_on_drag" type="bool" setter="enable_capture_on_drag" getter="is_capture_on_drag_enabled" default="false">
If [code]true[/code], this object will continue to receive input events as the mouse is dragged across its shapes.
</member>
<member name="input_ray_pickable" type="bool" setter="set_ray_pickable" getter="is_ray_pickable" default="true">
If [code]true[/code], the [CollisionObject3D]'s shapes will respond to [RayCast3D]s.
<member name="input_pickable" type="bool" setter="set_pickable" getter="is_pickable" default="true">
If [code]true[/code], this object can trigger input events. A pickable object will detect the mouse pointer entering and leaving, and, while the mouse is on it, generate [InputEventMouse] events.
[b]Note:[/b] Requires at least one [code]collision_layer[/code] bit to be set.
</member>
</members>
<signals>
Expand All @@ -243,24 +245,27 @@
</argument>
<argument index="1" name="event" type="InputEvent">
</argument>
<argument index="2" name="click_position" type="Vector3">
<argument index="2" name="position" type="Vector3">
</argument>
<argument index="3" name="click_normal" type="Vector3">
<argument index="3" name="normal" type="Vector3">
</argument>
<argument index="4" name="shape_idx" type="int">
</argument>
<description>
Emitted when [method _input_event] receives an event. See its description for details.
Emitted when the mouse is over any of this object's shapes. [code]position[/code] is the location in world space of the event and [code]normal[/code] is the normal of the surface of the [Shape3D] with index [code]shape_idx[/code].
[b]Note:[/b] Requires [member input_pickable] to be [code]true[/code].
</description>
</signal>
<signal name="mouse_entered">
<description>
Emitted when the mouse pointer enters any of this object's shapes.
[b]Note:[/b] Requires [member input_pickable] to be [code]true[/code].
</description>
</signal>
<signal name="mouse_exited">
<description>
Emitted when the mouse pointer exits all this object's shapes.
[b]Note:[/b] Requires [member input_pickable] to be [code]true[/code].
</description>
</signal>
</signals>
Expand Down
10 changes: 5 additions & 5 deletions doc/classes/CollisionPolygon2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
<member name="build_mode" type="int" setter="set_build_mode" getter="get_build_mode" enum="CollisionPolygon2D.BuildMode" default="0">
Collision build mode. Use one of the [enum BuildMode] constants.
</member>
<member name="disabled" type="bool" setter="set_disabled" getter="is_disabled" default="false">
If [code]true[/code], no collisions will be detected.
<member name="enabled" type="bool" setter="enable" getter="is_enabled" default="true">
If [code]true[/code], other objects will collide with this [CollisionPolygon2D].
</member>
<member name="one_way_collision" type="bool" setter="set_one_way_collision" getter="is_one_way_collision_enabled" default="false">
If [code]true[/code], only edges that face up, relative to [CollisionPolygon2D]'s rotation, will collide with other objects.
<member name="one_way_collision" type="bool" setter="enable_one_way_collision" getter="is_one_way_collision_enabled" default="false">
If [code]true[/code], other objects will only collide with edges that face up, relative to this [CollisionPolygon2D]'s rotation.
</member>
<member name="one_way_collision_margin" type="float" setter="set_one_way_collision_margin" getter="get_one_way_collision_margin" default="1.0">
The margin used for one-way collision (in pixels). Higher values will make the shape thicker, and work better for colliders that enter the polygon at a high velocity.
The margin used for one-way collisions (in pixels). Higher values will make the shape thicker, and work better for colliders that enter the polygon at a high velocity.
</member>
<member name="polygon" type="PackedVector2Array" setter="set_polygon" getter="get_polygon" default="PackedVector2Array( )">
The polygon's list of vertices. The final point will be connected to the first. The returned value is a clone of the [PackedVector2Array], not a reference.
Expand Down
4 changes: 2 additions & 2 deletions doc/classes/CollisionPolygon3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<member name="depth" type="float" setter="set_depth" getter="get_depth" default="1.0">
Length that the resulting collision extends in either direction perpendicular to its polygon.
</member>
<member name="disabled" type="bool" setter="set_disabled" getter="is_disabled" default="false">
If [code]true[/code], no collision will be produced.
<member name="enabled" type="bool" setter="enable" getter="is_enabled" default="true">
If [code]true[/code], other objects will collide with this [CollisionPolygon3D].
</member>
<member name="margin" type="float" setter="set_margin" getter="get_margin" default="0.04">
The collision margin for the generated [Shape3D]. See [member Shape3D.margin] for more details.
Expand Down
10 changes: 5 additions & 5 deletions doc/classes/CollisionShape2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
<methods>
</methods>
<members>
<member name="disabled" type="bool" setter="set_disabled" getter="is_disabled" default="false">
A disabled collision shape has no effect in the world. This property should be changed with [method Object.set_deferred].
<member name="enabled" type="bool" setter="enable" getter="is_enabled" default="true">
If [code]true[/code], other objects will collide with this [CollisionShape2D]. This property should be changed with [method Object.set_deferred].
</member>
<member name="one_way_collision" type="bool" setter="set_one_way_collision" getter="is_one_way_collision_enabled" default="false">
Sets whether this collision shape should only detect collision on one side (top or bottom).
<member name="one_way_collision" type="bool" setter="enable_one_way_collision" getter="is_one_way_collision_enabled" default="false">
If [code]true[/code], other objects will only collide with edges that face up, relative to this [CollisionShape2D]'s rotation.
</member>
<member name="one_way_collision_margin" type="float" setter="set_one_way_collision_margin" getter="get_one_way_collision_margin" default="1.0">
The margin used for one-way collision (in pixels). Higher values will make the shape thicker, and work better for colliders that enter the shape at a high velocity.
The margin used for one-way collisions (in pixels). Higher values will make the shape thicker, and work better for colliders that enter the shape at a high velocity.
</member>
<member name="shape" type="Shape2D" setter="set_shape" getter="get_shape">
The actual shape owned by this collision shape.
Expand Down
4 changes: 2 additions & 2 deletions doc/classes/CollisionShape3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
</method>
</methods>
<members>
<member name="disabled" type="bool" setter="set_disabled" getter="is_disabled" default="false">
A disabled collision shape has no effect in the world.
<member name="enabled" type="bool" setter="enable" getter="is_enabled" default="true">
If [code]true[/code], other objects will collide with this [CollisionShape3D].
</member>
<member name="shape" type="Shape3D" setter="set_shape" getter="get_shape">
The actual shape owned by this collision shape.
Expand Down
8 changes: 4 additions & 4 deletions doc/classes/Joint2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
<member name="bias" type="float" setter="set_bias" getter="get_bias" default="0.0">
When [member node_a] and [member node_b] move in different directions the [code]bias[/code] controls how fast the joint pulls them back to their original position. The lower the [code]bias[/code] the more the two bodies can pull on the joint.
</member>
<member name="disable_collision" type="bool" setter="set_exclude_nodes_from_collision" getter="get_exclude_nodes_from_collision" default="true">
If [code]true[/code], [member node_a] and [member node_b] can not collide.
<member name="collisions_between_bodies" type="bool" setter="enable_collisions_between_bodies" getter="is_collisions_between_bodies_enabled" default="false">
If [code]true[/code], the [PhysicsBody2D]s assigned to [member node_a] and [member node_b] will collide with each other.
</member>
<member name="node_a" type="NodePath" setter="set_node_a" getter="get_node_a" default="NodePath(&quot;&quot;)">
The first body attached to the joint. Must derive from [PhysicsBody2D].
The first [PhysicsBody2D] attached to the joint.
</member>
<member name="node_b" type="NodePath" setter="set_node_b" getter="get_node_b" default="NodePath(&quot;&quot;)">
The second body attached to the joint. Must derive from [PhysicsBody2D].
The second [PhysicsBody2D] attached to the joint.
</member>
</members>
<constants>
Expand Down
Loading