TargetingShapeCast2D
AUTO-GENERATED FILE – DO NOT EDIT MANUALLY
Encapsulates ShapeCast2D-based targeting logic as a reusable component
Source File: addons/grid_building/systems/grid_targeting/grid_positioner/targeting_shape_cast_2d.gd
Extends: ShapeCast2D
Exported Properties
- Property:
debug_log_collisions: bool = false- Local debug flag: can be toggled per-instance in editor or by code
Private Properties
- Property:
_logger: [GBLogger](./gb-logger/) = null(private) - GB dependencies (typed) - Property:
_targeting_state: [GridTargetingState](./grid-targeting-state/) = null(private)
Public Methods
resolve_gb_dependencies
Resolve Grid Building dependencies (logger, targeting state)
update_target
Update the GridTargetingState.target based on current collisions Skips automatic updates when manipulation is active (target set manually)
Private Methods
_physics_process
Flags: private
Physics process: continuously update targeting state based on ShapeCast2D collisions
_log_collisions
Flags: private
Log current collisions for diagnostics
_format_collision_layers
Flags: private
Format collision mask as layer names or numbers
_promote_to_targetable_root
Flags: private
Promote a raw collider (which may be a child physics body) to its root Area2D if that root
represents the intended gameplay target. This handles scenes like the Smithy where the
visual/physics StaticBody2D is a child of an Area2D which carries the targetable layer.
raw The collider returned by ShapeCast2D.
[return] A Node2D to use as targeting root (prefer Area2D on targetable layer) or the original if no promotion needed.