CollisionMapper
Summary
Section titled “Summary”Responsibilities: - Translate CollisionShape2D / CollisionPolygon2D geometry into tile offsets used by placement rules and indicators. - Apply filtering, normalization, and heuristics to remove slivers and normalize pivots for consistent indicators. - Provide caching and utility helpers consumed by IndicatorManager and the placement pipeline.
Properties
Section titled “Properties”indicator_contact_positions: Array = []test_indicator: RuleCheckIndicatortest_setups: Array[CollisionTestSetup2D] = []Maps each CollisionObject2D to its CollisionTestSetup2D for collision testing.
Methods
Section titled “Methods”static func create_with_injection( container: GBCompositionContainer ) -> CollisionMapperFactory Creates a CollisionMapper with injected dependencies and validates wiring. This is the preferred method for instantiating a CollisionMapper for test suites to avoid manual injection or instancing owning parent nodes. Returns: CollisionMapper – a ready instance; logs warnings if injection issues are found.
func get_runtime_issues( ) -> Array[String]Validation Returns a list of issues if required state is missing; empty when valid. Returns: Array[String]
func _init( targeting_state: GridTargetingState, p_logger: GBLogger ) -> voidConstructor Inject targeting state and logger. Parameters: •
targeting_state: GridTargetingState – provides map and positioner. •p_logger: GBLogger – for diagnostics.func resolve_gb_dependencies( container: GBCompositionContainer ) -> boolManual Injection Resolve dependencies from the container after construction. Useful when the mapper is instantiated without the factory. Returns - bool - Whether the injection was successful or not
func _guard_setup_complete( ) -> boolGuard: Setup Validation Checks if setup() has been called and logs warnings if incomplete. Returns: bool – true if setup is complete, false otherwise (logs and prevents continuation).
Source
Section titled “Source”addons/grid_building/placement/manager/components/mapper/collision_mapper.gd
This API reference is automatically generated from the plugin source code. For implementation examples and usage guides, see the guides section.