2017-09-13 04:42:36 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2020-03-31 00:22:57 +08:00
<class name= "CollisionObject3D" inherits= "Node3D" version= "4.0" >
2017-09-13 04:42:36 +08:00
<brief_description >
2017-09-24 10:47:13 +08:00
Base node for collision objects.
2017-09-13 04:42:36 +08:00
</brief_description>
<description >
2020-03-31 00:22:57 +08:00
CollisionObject3D is the base class for physics objects. It can hold any number of collision [Shape3D]s. Each shape must be assigned to a [i]shape owner[/i]. The CollisionObject3D can have any number of shape owners. Shape owners are not nodes and do not appear in the editor, but are accessible through code using the [code]shape_owner_*[/code] methods.
2017-09-13 04:42:36 +08:00
</description>
<tutorials >
</tutorials>
<methods >
<method name= "_input_event" qualifiers= "virtual" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2021-08-22 23:37:22 +08:00
<argument index= "0" name= "camera" type= "Camera3D" />
2021-07-30 21:28:05 +08:00
<argument index= "1" name= "event" type= "InputEvent" />
<argument index= "2" name= "position" type= "Vector3" />
<argument index= "3" name= "normal" type= "Vector3" />
<argument index= "4" name= "shape_idx" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2021-06-07 14:34:21 +08:00
Receives unhandled [InputEvent]s. [code]position[/code] is the location in world space of the mouse pointer on the surface of the shape with index [code]shape_idx[/code] and [code]normal[/code] is the normal vector of the surface at that point. Connect to the [signal input_event] signal to easily pick up these events.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "create_shape_owner" >
2021-07-30 21:28:05 +08:00
<return type= "int" />
<argument index= "0" name= "owner" type= "Object" />
2017-09-13 04:42:36 +08:00
<description >
2017-09-24 10:47:13 +08:00
Creates a new shape owner for the given object. Returns [code]owner_id[/code] of the new owner for future reference.
2017-09-13 04:42:36 +08:00
</description>
</method>
2021-08-12 07:01:38 +08:00
<method name= "get_collision_layer_value" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "bool" />
2021-08-12 07:01:38 +08:00
<argument index= "0" name= "layer_number" type= "int" />
2020-10-13 21:09:31 +08:00
<description >
2021-08-12 07:01:38 +08:00
Returns whether or not the specified layer of the [member collision_layer] is enabled, given a [code]layer_number[/code] between 1 and 32.
2020-10-13 21:09:31 +08:00
</description>
</method>
2021-08-12 07:01:38 +08:00
<method name= "get_collision_mask_value" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "bool" />
2021-08-12 07:01:38 +08:00
<argument index= "0" name= "layer_number" type= "int" />
2020-10-13 21:09:31 +08:00
<description >
2021-08-12 07:01:38 +08:00
Returns whether or not the specified layer of the [member collision_mask] is enabled, given a [code]layer_number[/code] between 1 and 32.
2020-10-13 21:09:31 +08:00
</description>
</method>
2017-09-13 04:42:36 +08:00
<method name= "get_rid" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "RID" />
2017-09-13 04:42:36 +08:00
<description >
2017-09-24 10:47:13 +08:00
Returns the object's [RID].
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "get_shape_owners" >
2021-07-30 21:28:05 +08:00
<return type= "Array" />
2017-09-13 04:42:36 +08:00
<description >
2017-09-24 10:47:13 +08:00
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.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "is_shape_owner_disabled" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "bool" />
<argument index= "0" name= "owner_id" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2018-12-20 20:46:54 +08:00
If [code]true[/code], the shape owner and its shapes are disabled.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "remove_shape_owner" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
<argument index= "0" name= "owner_id" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2017-09-24 10:47:13 +08:00
Removes the given shape owner.
2017-09-13 04:42:36 +08:00
</description>
</method>
2021-08-12 07:01:38 +08:00
<method name= "set_collision_layer_value" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2021-08-12 07:01:38 +08:00
<argument index= "0" name= "layer_number" type= "int" />
2021-07-30 21:28:05 +08:00
<argument index= "1" name= "value" type= "bool" />
2020-10-13 21:09:31 +08:00
<description >
2021-08-12 07:01:38 +08:00
Based on [code]value[/code], enables or disables the specified layer in the [member collision_layer], given a [code]layer_number[/code] between 1 and 32.
2020-10-13 21:09:31 +08:00
</description>
</method>
2021-08-12 07:01:38 +08:00
<method name= "set_collision_mask_value" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2021-08-12 07:01:38 +08:00
<argument index= "0" name= "layer_number" type= "int" />
2021-07-30 21:28:05 +08:00
<argument index= "1" name= "value" type= "bool" />
2020-10-13 21:09:31 +08:00
<description >
2021-08-12 07:01:38 +08:00
Based on [code]value[/code], enables or disables the specified layer in the [member collision_mask], given a [code]layer_number[/code] between 1 and 32.
2020-10-13 21:09:31 +08:00
</description>
</method>
2017-09-13 04:42:36 +08:00
<method name= "shape_find_owner" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "int" />
<argument index= "0" name= "shape_index" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2017-09-24 10:47:13 +08:00
Returns the [code]owner_id[/code] of the given shape.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_owner_add_shape" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
<argument index= "0" name= "owner_id" type= "int" />
<argument index= "1" name= "shape" type= "Shape3D" />
2017-09-13 04:42:36 +08:00
<description >
2020-03-31 00:22:57 +08:00
Adds a [Shape3D] to the shape owner.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_owner_clear_shapes" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
<argument index= "0" name= "owner_id" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2017-09-24 10:47:13 +08:00
Removes all shapes from the shape owner.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_owner_get_owner" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "Object" />
<argument index= "0" name= "owner_id" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2017-09-24 10:47:13 +08:00
Returns the parent object of the given shape owner.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_owner_get_shape" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "Shape3D" />
<argument index= "0" name= "owner_id" type= "int" />
<argument index= "1" name= "shape_id" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2020-03-31 00:22:57 +08:00
Returns the [Shape3D] with the given id from the given shape owner.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_owner_get_shape_count" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "int" />
<argument index= "0" name= "owner_id" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2017-09-24 10:47:13 +08:00
Returns the number of shapes the given shape owner contains.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_owner_get_shape_index" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "int" />
<argument index= "0" name= "owner_id" type= "int" />
<argument index= "1" name= "shape_id" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2020-03-31 00:22:57 +08:00
Returns the child index of the [Shape3D] with the given id from the given shape owner.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_owner_get_transform" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "Transform3D" />
<argument index= "0" name= "owner_id" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2020-05-03 16:27:36 +08:00
Returns the shape owner's [Transform3D].
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_owner_remove_shape" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
<argument index= "0" name= "owner_id" type= "int" />
<argument index= "1" name= "shape_id" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2017-09-24 10:47:13 +08:00
Removes a shape from the given shape owner.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_owner_set_disabled" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
<argument index= "0" name= "owner_id" type= "int" />
<argument index= "1" name= "disabled" type= "bool" />
2017-09-13 04:42:36 +08:00
<description >
2018-12-20 20:46:54 +08:00
If [code]true[/code], disables the given shape owner.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_owner_set_transform" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
<argument index= "0" name= "owner_id" type= "int" />
<argument index= "1" name= "transform" type= "Transform3D" />
2017-09-13 04:42:36 +08:00
<description >
2020-05-03 16:27:36 +08:00
Sets the [Transform3D] of the given shape owner.
2017-09-13 04:42:36 +08:00
</description>
</method>
</methods>
<members >
2020-10-13 21:09:31 +08:00
<member name= "collision_layer" type= "int" setter= "set_collision_layer" getter= "get_collision_layer" default= "1" >
2021-07-16 03:38:48 +08:00
The physics layers this CollisionObject3D [b]is in[/b]. Collision objects can exist in one or more of 32 different layers. See also [member collision_mask].
2021-11-15 17:43:07 +08:00
[b]Note:[/b] Object A can detect a contact with object B only if object B is in any of the layers that object A scans. See [url=$DOCS_URL/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information.
2020-10-13 21:09:31 +08:00
</member>
<member name= "collision_mask" type= "int" setter= "set_collision_mask" getter= "get_collision_mask" default= "1" >
2021-07-16 03:38:48 +08:00
The physics layers this CollisionObject3D [b]scans[/b]. Collision objects can scan one or more of 32 different layers. See also [member collision_layer].
2021-11-15 17:43:07 +08:00
[b]Note:[/b] Object A can detect a contact with object B only if object B is in any of the layers that object A scans. See [url=$DOCS_URL/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information.
2020-10-13 21:09:31 +08:00
</member>
2021-06-18 09:09:40 +08:00
<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>
2019-06-29 18:38:01 +08:00
<member name= "input_capture_on_drag" type= "bool" setter= "set_capture_input_on_drag" getter= "get_capture_input_on_drag" default= "false" >
2020-03-31 00:22:57 +08:00
If [code]true[/code], the [CollisionObject3D] will continue to receive input events as the mouse is dragged across its shapes.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "input_ray_pickable" type= "bool" setter= "set_ray_pickable" getter= "is_ray_pickable" default= "true" >
2022-01-18 08:04:43 +08:00
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 [member collision_layer] bit to be set.
2017-09-13 04:42:36 +08:00
</member>
</members>
<signals >
<signal name= "input_event" >
2021-07-30 21:28:05 +08:00
<argument index= "0" name= "camera" type= "Node" />
<argument index= "1" name= "event" type= "InputEvent" />
<argument index= "2" name= "position" type= "Vector3" />
<argument index= "3" name= "normal" type= "Vector3" />
<argument index= "4" name= "shape_idx" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2021-06-07 14:34:21 +08:00
Emitted when the object receives an unhandled [InputEvent]. [code]position[/code] is the location in world space of the mouse pointer on the surface of the shape with index [code]shape_idx[/code] and [code]normal[/code] is the normal vector of the surface at that point.
2017-09-13 04:42:36 +08:00
</description>
</signal>
<signal name= "mouse_entered" >
<description >
2017-09-24 10:47:13 +08:00
Emitted when the mouse pointer enters any of this object's shapes.
2017-09-13 04:42:36 +08:00
</description>
</signal>
<signal name= "mouse_exited" >
<description >
2017-09-24 10:47:13 +08:00
Emitted when the mouse pointer exits all this object's shapes.
2017-09-13 04:42:36 +08:00
</description>
</signal>
</signals>
<constants >
2021-06-18 09:09:40 +08:00
<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>
2017-09-13 04:42:36 +08:00
</constants>
</class>