Node for physics collision sweep and immediate overlap queries. Similar to the [RayCast3D] node.
Shape casting allows to detect collision objects by sweeping the [member shape] along the cast direction determined by [member target_position] (useful for things like beam weapons).
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 [b]physics_frame[/b]. This also helps to overcome some limitations of [Area3D] when used as a continuous detection area, often requiring waiting a couple of frames before collision information is available to [Area3D] nodes, and when using the signals creates unnecessary complexity.
The node can detect multiple collision objects, but it's usually used to detect the first collision.
[b]Note:[/b] Shape casting is more computationally expensive compared to ray casting.
Adds a collision exception so the shape does not report collisions with the specified [CollisionObject3D] node.
Adds a collision exception so the shape does not report collisions with the specified [RID].
Removes all collision exceptions for this [ShapeCast3D].
Updates the collision information for the shape. Use this method to update the collision information immediately instead of waiting for the next [code]_physics_process[/code] call, for example if the shape or its parent has changed state.
[b]Note:[/b] [code]enabled == true[/code] is not required for this to work.
The fraction from the [ShapeCast3D]'s origin to its [member target_position] (between 0 and 1) of how far the shape can move without triggering a collision.
The fraction from the [ShapeCast3D]'s origin to its [member target_position] (between 0 and 1) of how far the shape must move to trigger a collision.
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]).
Returns the [RID] of the collided object of one of the multiple collisions at [param index].
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]).
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.
Returns whether or not the specified layer of the [member collision_mask] is enabled, given a [param layer_number] between 1 and 32.
Returns the normal of one of the multiple collisions at [param index] of the intersecting object.
Returns the collision point of one of the multiple collisions at [param index] where the shape intersects the colliding object.
[b]Note:[/b] this point is in the [b]global[/b] coordinate system.
Returns whether any object is intersecting with the shape's vector (considering the vector length).
Removes a collision exception so the shape does report collisions with the specified [CollisionObject3D] node.
Removes a collision exception so the shape does report collisions with the specified [RID].
This method is used internally to update the debug gizmo in the editor. Any code placed in this function will be called whenever the [member shape] resource is modified.
Based on [param value], enables or disables the specified layer in the [member collision_mask], given a [param layer_number] between 1 and 32.
If [code]true[/code], collision with [Area3D]s will be reported.
If [code]true[/code], collision with [PhysicsBody3D]s will be reported.
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.
Returns the complete collision information from the collision sweep. The data returned is the same as in the [method PhysicsDirectSpaceState3D.get_rest_info] method.
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.
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.
If [code]true[/code], collisions will be reported.
If [code]true[/code], the parent node will be excluded from collision detection.
The collision margin for the shape. A larger margin helps detecting collisions more consistently, at the cost of precision.
The number of intersections can be limited with this parameter, to reduce the processing time.
The [Shape3D]-derived shape to be used for collision queries.
The shape's destination point, relative to this node's [code]position[/code].