summaryrefslogtreecommitdiff
path: root/doc/classes/CollisionObject3D.xml
blob: 4523a63c4ce0dbab879601207d88d8dc5a3c7134 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
<?xml version="1.0" encoding="UTF-8" ?>
<class name="CollisionObject3D" inherits="Node3D" version="4.0">
	<brief_description>
		Base node for collision objects.
	</brief_description>
	<description>
		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.
	</description>
	<tutorials>
	</tutorials>
	<methods>
		<method name="_input_event" qualifiers="virtual">
			<return type="void">
			</return>
			<argument index="0" name="camera" type="Object">
			</argument>
			<argument index="1" name="event" type="InputEvent">
			</argument>
			<argument index="2" name="click_position" type="Vector3">
			</argument>
			<argument index="3" name="click_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.
			</description>
		</method>
		<method name="create_shape_owner">
			<return type="int">
			</return>
			<argument index="0" name="owner" type="Object">
			</argument>
			<description>
				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="get_collision_layer_bit" qualifiers="const">
			<return type="bool">
			</return>
			<argument index="0" name="bit" type="int">
			</argument>
			<description>
				Returns whether or not the specified [code]bit[/code] of the [member collision_layer] is set.
			</description>
		</method>
		<method name="get_collision_mask_bit" qualifiers="const">
			<return type="bool">
			</return>
			<argument index="0" name="bit" type="int">
			</argument>
			<description>
				Returns whether or not the specified [code]bit[/code] of the [member collision_mask] is set.
			</description>
		</method>
		<method name="get_rid" qualifiers="const">
			<return type="RID">
			</return>
			<description>
				Returns the object's [RID].
			</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">
			<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="remove_shape_owner">
			<return type="void">
			</return>
			<argument index="0" name="owner_id" type="int">
			</argument>
			<description>
				Removes the given shape owner.
			</description>
		</method>
		<method name="set_collision_layer_bit">
			<return type="void">
			</return>
			<argument index="0" name="bit" type="int">
			</argument>
			<argument index="1" name="value" type="bool">
			</argument>
			<description>
				If [code]value[/value] is [code]true[/code], sets the specified [code]bit[/code] in the the [member collision_layer].
				If [code]value[/value] is [code]false[/code], clears the specified [code]bit[/code] in the the [member collision_layer].
			</description>
		</method>
		<method name="set_collision_mask_bit">
			<return type="void">
			</return>
			<argument index="0" name="bit" type="int">
			</argument>
			<argument index="1" name="value" type="bool">
			</argument>
			<description>
				If [code]value[/value] is [code]true[/code], sets the specified [code]bit[/code] in the the [member collision_mask].
				If [code]value[/value] is [code]false[/code], clears the specified [code]bit[/code] in the the [member collision_mask].
			</description>
		</method>
		<method name="shape_find_owner" qualifiers="const">
			<return type="int">
			</return>
			<argument index="0" name="shape_index" type="int">
			</argument>
			<description>
				Returns the [code]owner_id[/code] of the given shape.
			</description>
		</method>
		<method name="shape_owner_add_shape">
			<return type="void">
			</return>
			<argument index="0" name="owner_id" type="int">
			</argument>
			<argument index="1" name="shape" type="Shape3D">
			</argument>
			<description>
				Adds a [Shape3D] to the shape owner.
			</description>
		</method>
		<method name="shape_owner_clear_shapes">
			<return type="void">
			</return>
			<argument index="0" name="owner_id" type="int">
			</argument>
			<description>
				Removes all shapes from the shape owner.
			</description>
		</method>
		<method name="shape_owner_get_owner" qualifiers="const">
			<return type="Object">
			</return>
			<argument index="0" name="owner_id" type="int">
			</argument>
			<description>
				Returns the parent object of the given shape owner.
			</description>
		</method>
		<method name="shape_owner_get_shape" qualifiers="const">
			<return type="Shape3D">
			</return>
			<argument index="0" name="owner_id" type="int">
			</argument>
			<argument index="1" name="shape_id" type="int">
			</argument>
			<description>
				Returns the [Shape3D] with the given id from the given shape owner.
			</description>
		</method>
		<method name="shape_owner_get_shape_count" qualifiers="const">
			<return type="int">
			</return>
			<argument index="0" name="owner_id" type="int">
			</argument>
			<description>
				Returns the number of shapes the given shape owner contains.
			</description>
		</method>
		<method name="shape_owner_get_shape_index" qualifiers="const">
			<return type="int">
			</return>
			<argument index="0" name="owner_id" type="int">
			</argument>
			<argument index="1" name="shape_id" type="int">
			</argument>
			<description>
				Returns the child index of the [Shape3D] with the given id from the given shape owner.
			</description>
		</method>
		<method name="shape_owner_get_transform" qualifiers="const">
			<return type="Transform">
			</return>
			<argument index="0" name="owner_id" type="int">
			</argument>
			<description>
				Returns the shape owner's [Transform].
			</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">
			</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>
			<argument index="0" name="owner_id" type="int">
			</argument>
			<argument index="1" name="transform" type="Transform">
			</argument>
			<description>
				Sets the [Transform] of the given shape owner.
			</description>
		</method>
	</methods>
	<members>
		<member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer" default="1">
			The physics layers this CollisionObject3D is in. Collision objects can exist in one or more of 32 different layers. See also [member collision_mask].
			[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="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="1">
			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_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="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>
		<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>
	</members>
	<signals>
		<signal name="input_event">
			<argument index="0" name="camera" type="Node">
			</argument>
			<argument index="1" name="event" type="InputEvent">
			</argument>
			<argument index="2" name="click_position" type="Vector3">
			</argument>
			<argument index="3" name="click_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.
			</description>
		</signal>
		<signal name="mouse_entered">
			<description>
				Emitted when the mouse pointer enters any of this object's shapes.
			</description>
		</signal>
		<signal name="mouse_exited">
			<description>
				Emitted when the mouse pointer exits all this object's shapes.
			</description>
		</signal>
	</signals>
	<constants>
	</constants>
</class>