Debian Codegraph @

doc/classes/ShapeCast3D.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <class name="ShapeCast3D" inherits="Node3D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 A 3D shape that sweeps a region of space to detect [CollisionObject3D]s.
5 </brief_description>
6 <description>
7 Shape casting allows to detect collision objects by sweeping its [member shape] along the cast direction determined by [member target_position]. This is similar to [RayCast3D], but it allows for sweeping a region of space, rather than just a straight line. [ShapeCast3D] can detect multiple collision objects. It is useful for things like wide laser beams or snapping a simple shape to a floor.
8 Immediate collision overlaps can be done with the [member target_position] set to [code]Vector3(0, 0, 0)[/code] and by calling [method force_shapecast_update] within the same physics frame. This helps to overcome some limitations of [Area3D] when used as an instantaneous detection area, as collision information isn't immediately available to it.
9 [b]Note:[/b] Shape casting is more computationally expensive than ray casting.
10 </description>
11 <tutorials>
12 </tutorials>
13 <methods>
14 <method name="add_exception">
15 <return type="void" />
16 <param index="0" name="node" type="CollisionObject3D" />
17 <description>
18 Adds a collision exception so the shape does not report collisions with the specified node.
19 </description>
20 </method>
21 <method name="add_exception_rid">
22 <return type="void" />
23 <param index="0" name="rid" type="RID" />
24 <description>
25 Adds a collision exception so the shape does not report collisions with the specified [RID].
26 </description>
27 </method>
28 <method name="clear_exceptions">
29 <return type="void" />
30 <description>
31 Removes all collision exceptions for this shape.
32 </description>
33 </method>
34 <method name="force_shapecast_update">
35 <return type="void" />
36 <description>
37 Updates the collision information for the shape immediately, without waiting for the next [code]_physics_process[/code] call. Use this method, for example, when the shape or its parent has changed state.
38 [b]Note:[/b] Setting [member enabled] to [code]true[/code] is not required for this to work.
39 </description>
40 </method>
41 <method name="get_closest_collision_safe_fraction" qualifiers="const">
42 <return type="float" />
43 <description>
44 Returns the fraction from this cast's origin to its [member target_position] of how far the shape can move without triggering a collision, as a value between [code]0.0[/code] and [code]1.0[/code].
45 </description>
46 </method>
47 <method name="get_closest_collision_unsafe_fraction" qualifiers="const">
48 <return type="float" />
49 <description>
50 Returns the fraction from this cast's origin to its [member target_position] of how far the shape must move to trigger a collision, as a value between [code]0.0[/code] and [code]1.0[/code].
51 In ideal conditions this would be the same as [method get_closest_collision_safe_fraction], however shape casting is calculated in discrete steps, so the precise point of collision can occur between two calculated positions.
52 </description>
53 </method>
54 <method name="get_collider" qualifiers="const">
55 <return type="Object" />
56 <param index="0" name="index" type="int" />
57 <description>
58 Returns the collided [Object] of one of the multiple collisions at [param index], or [code]null[/code] if no object is intersecting the shape (i.e. [method is_colliding] returns [code]false[/code]).
59 </description>
60 </method>
61 <method name="get_collider_rid" qualifiers="const">
62 <return type="RID" />
63 <param index="0" name="index" type="int" />
64 <description>
65 Returns the [RID] of the collided object of one of the multiple collisions at [param index].
66 </description>
67 </method>
68 <method name="get_collider_shape" qualifiers="const">
69 <return type="int" />
70 <param index="0" name="index" type="int" />
71 <description>
72 Returns the shape ID of the colliding shape of one of the multiple collisions at [param index], or [code]0[/code] if no object is intersecting the shape (i.e. [method is_colliding] returns [code]false[/code]).
73 </description>
74 </method>
75 <method name="get_collision_count" qualifiers="const">
76 <return type="int" />
77 <description>
78 The number of collisions detected at the point of impact. Use this to iterate over multiple collisions as provided by [method get_collider], [method get_collider_shape], [method get_collision_point], and [method get_collision_normal] methods.
79 </description>
80 </method>
81 <method name="get_collision_mask_value" qualifiers="const">
82 <return type="bool" />
83 <param index="0" name="layer_number" type="int" />
84 <description>
85 Returns whether or not the specified layer of the [member collision_mask] is enabled, given a [param layer_number] between 1 and 32.
86 </description>
87 </method>
88 <method name="get_collision_normal" qualifiers="const">
89 <return type="Vector3" />
90 <param index="0" name="index" type="int" />
91 <description>
92 Returns the normal of one of the multiple collisions at [param index] of the intersecting object.
93 </description>
94 </method>
95 <method name="get_collision_point" qualifiers="const">
96 <return type="Vector3" />
97 <param index="0" name="index" type="int" />
98 <description>
99 Returns the collision point of one of the multiple collisions at [param index] where the shape intersects the colliding object.
100 [b]Note:[/b] This point is in the [b]global[/b] coordinate system.
101 </description>
102 </method>
103 <method name="is_colliding" qualifiers="const">
104 <return type="bool" />
105 <description>
106 Returns whether any object is intersecting with the shape's vector (considering the vector length).
107 </description>
108 </method>
109 <method name="remove_exception">
110 <return type="void" />
111 <param index="0" name="node" type="CollisionObject3D" />
112 <description>
113 Removes a collision exception so the shape does report collisions with the specified node.
114 </description>
115 </method>
116 <method name="remove_exception_rid">
117 <return type="void" />
118 <param index="0" name="rid" type="RID" />
119 <description>
120 Removes a collision exception so the shape does report collisions with the specified [RID].
121 </description>
122 </method>
123 <method name="resource_changed" deprecated="Use [signal Resource.changed] instead.">
124 <return type="void" />
125 <param index="0" name="resource" type="Resource" />
126 <description>
127 This method does nothing.
128 </description>
129 </method>
130 <method name="set_collision_mask_value">
131 <return type="void" />
132 <param index="0" name="layer_number" type="int" />
133 <param index="1" name="value" type="bool" />
134 <description>
135 Based on [param value], enables or disables the specified layer in the [member collision_mask], given a [param layer_number] between 1 and 32.
136 </description>
137 </method>
138 </methods>
139 <members>
140 <member name="collide_with_areas" type="bool" setter="set_collide_with_areas" getter="is_collide_with_areas_enabled" default="false">
141 If [code]true[/code], collisions with [Area3D]s will be reported.
142 </member>
143 <member name="collide_with_bodies" type="bool" setter="set_collide_with_bodies" getter="is_collide_with_bodies_enabled" default="true">
144 If [code]true[/code], collisions with [PhysicsBody3D]s will be reported.
145 </member>
146 <member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="1">
147 The shape's collision mask. Only objects in at least one collision layer enabled in the mask will be detected. See [url=$DOCS_URL/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information.
148 </member>
149 <member name="collision_result" type="Array" setter="" getter="get_collision_result" default="[]">
150 Returns the complete collision information from the collision sweep. The data returned is the same as in the [method PhysicsDirectSpaceState3D.get_rest_info] method.
151 </member>
152 <member name="debug_shape_custom_color" type="Color" setter="set_debug_shape_custom_color" getter="get_debug_shape_custom_color" default="Color(0, 0, 0, 1)">
153 The custom color to use to draw the shape in the editor and at run-time if [b]Visible Collision Shapes[/b] is enabled in the [b]Debug[/b] menu. This color will be highlighted at run-time if the [ShapeCast3D] is colliding with something.
154 If set to [code]Color(0.0, 0.0, 0.0)[/code] (by default), the color set in [member ProjectSettings.debug/shapes/collision/shape_color] is used.
155 </member>
156 <member name="enabled" type="bool" setter="set_enabled" getter="is_enabled" default="true">
157 If [code]true[/code], collisions will be reported.
158 </member>
159 <member name="exclude_parent" type="bool" setter="set_exclude_parent_body" getter="get_exclude_parent_body" default="true">
160 If [code]true[/code], the parent node will be excluded from collision detection.
161 </member>
162 <member name="margin" type="float" setter="set_margin" getter="get_margin" default="0.0">
163 The collision margin for the shape. A larger margin helps detecting collisions more consistently, at the cost of precision.
164 </member>
165 <member name="max_results" type="int" setter="set_max_results" getter="get_max_results" default="32">
166 The number of intersections can be limited with this parameter, to reduce the processing time.
167 </member>
168 <member name="shape" type="Shape3D" setter="set_shape" getter="get_shape">
169 The shape to be used for collision queries.
170 </member>
171 <member name="target_position" type="Vector3" setter="set_target_position" getter="get_target_position" default="Vector3(0, -1, 0)">
172 The shape's destination point, relative to this node's [member Node3D.position].
173 </member>
174 </members>
175 </class>