TargetingShapeCast2D
AUTO-GENERATED FILE — DO NOT EDIT MANUALLY
Source: systems/grid_targeting/grid_positioner/targeting_shape_cast_2d.gd
Version: 5.1
class_name: TargetingShapeCast2D
extends: ShapeCast2D
Summary
Encapsulates ShapeCast2D-based targeting logic as a reusable component
Provides grid targeting functionality by extending ShapeCast2D with configuration validation, dependency injection, and structured error reporting. Integrates with the Grid Building system’s logger and state management.
GridPlacement 6.0 C# equivalent: TargetSensor2D
Key features:
- Automatic configuration validation with typed error reporting
- Dependency injection for logger and targeting state
- Physics-independent logic component for testability
- Fallback overlap detection when ShapeCast2D fails
- Comprehensive collision diagnostics and logging
Usage:
| |
Dependencies:
- GPLogger for structured logging
- TargetingService for target management
Signals
(none)
Exports
debug_log_collisions- Local debug flag: can be toggled per-instance in editor or by code
Methods
_init()resolve_gb_dependencies()- Resolve Grid Building dependencies (logger, targeting service)
_retry_resolve_gb_dependencies()_ready()- Ensure ShapeCast2D is enabled on ready
_physics_process()- Physics process: continuously update targeting state based on ShapeCast2D collisions
update_target()- Update the GridTargetingState.target based on current collisions Skips automatic updates when manipulation is active (target set manually)
_get_current_collider()- Returns the collider detected either by ShapeCast2D or overlap fallback
_query_overlap_collider()- Queries the physics space directly to detect overlapping colliders when ShapeCast2D fails to report
_run_configuration_verification()_log_configuration_issue()_log_collisions()- Log current collisions for diagnostics
_format_collision_layers()- Format collision mask as layer names or numbers