TargetingShapeCast2D
Promote a raw collider (which...
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. [param 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.
Version: v5.0.0
Inherits: ShapeCast2D
Source: targeting_shape_cast_2d.gd
Parsing: AST-based for maximum accuracy with symbol typing
Variables
_logger:
GB dependencies (typed)
_targeting_state:
Methods
resolve_gb_dependencies
Signature: resolve_gb_dependencies(p_container: GBCompositionContainer) -> void
Resolve Grid Building dependencies (logger, targeting state)
Returns: void
Parameters:
p_container: GBCompositionContainer
_physics_process
Signature: _physics_process(_delta: float) -> void
Physics process: continuously update targeting state based on ShapeCast2D collisions
Returns: void
Parameters:
_delta: float
update_target
Signature: update_target() -> void
Skips automatic updates when manipulation is active (target set manually)
Returns: void
_log_collisions
Signature: _log_collisions() -> void
Log current collisions for diagnostics
Returns: void
_format_collision_layers
Signature: _format_collision_layers(mask: int) -> String
Format collision mask as layer names or numbers
Returns: String
Parameters:
mask: int
_promote_to_targetable_root
Signature: _promote_to_targetable_root(raw: Object) -> Node2D
[return] A Node2D to use as targeting root (prefer Area2D on targetable layer) or the original if no promotion needed.
Returns: Node2D
Parameters:
raw: Object