PhysicsMatchingUtils2D

AUTO-GENERATED FILE – DO NOT EDIT MANUALLY

Utilities for Getting Collision Shapes, Objects, and Polygons for Collision Tasks

Source File: addons/grid_building/utils/physics_matching_utils_2d.gd

Public Methods

get_matching_collision_objects

1
2
3
4
5
get_matching_collision_objects(
    p_container : Node2D,
    shape_cast : ShapeCast2D,
    require_all_mask_layers : bool = false
) -> Array[CollisionObject2D]

Flags: static

Gets all collision objects from the preview_instance including self and children for matching nodes. Must have layers matching at least one of the mask layers from the tile collision template.

p_container: Node2D - Container to search for collision objects

shape_cast: ShapeCast2D - Shape cast providing collision mask for matching

require_all_mask_layers: bool - Whether objects must match all mask layers (default false)


get_castable_shapes

1
2
3
4
get_castable_shapes(
    instance : Node2D,
    shape_cast : ShapeCast2D
) -> Array[CollisionShape2D]

Flags: static

From a given instance_root, find the collision shapes attached to collision objects that have a layer that matches the placement mask layers of the building system


get_castable_collision_polygons

1
2
3
4
get_castable_collision_polygons(
    instance : Node2D,
    shape_cast : ShapeCast2D
) -> Array[CollisionPolygon2D]

Flags: static

Get all collision polygon 2d nodes that are children with matching layers to the tile indicator mask


get_physics_layer_names

1
get_physics_layer_names(p_layers : Array[int]) -> Array[String]

Flags: static


get_layers_from_bitmask

1
get_layers_from_bitmask(p_bitmask : int) -> Array[int]

Flags: static

Gets the layer numbers that are active in a given mask value.

p_bitmask: int - Physics layer bitmask to extract layer numbers from


get_physics_layer_names_from_mask

1
get_physics_layer_names_from_mask(p_bitmask : int) -> Array[String]

Flags: static

Gets the active layer names from a given physics mask int.

p_bitmask: int - Physics layer bitmask to get layer names for


object_has_matching_layer

1
2
3
4
object_has_matching_layer(
    col_obj : CollisionObject2D,
    p_check_mask : int
) -> bool

Flags: static

Checks if a collision object has any active physics layers that match a given bitmask.

col_obj: CollisionObject2D - Collision object to check layers for

p_check_mask: int - Physics layer bitmask to match against