Skip to main content

Overlapping Components

When multiple components are spawned conditionally and their SpawnConditions are satisfied within the same area, they may spawn on top of each other.

For example:

  • A "Barrier" mesh is configured to spawn wherever the "Turn" Label is fulfilled.
  • A "BarrierStart" mesh is set to spawn at the start of the "Turn" Label.

As a result, both meshes are spawned at the beginning of the Label and overlap each other.

image

Overlap Resolver

To address the aforementioned issues, we implemented the "Overlap Resolver" system. It allows:

  • Tagging components that should not overlap.
  • Assigning priorities to components to determine which component takes precedence when overlaps occur.

The system removes overlapping components with lower priority, leaving only the components with the highest priority.

Here is an example setup that we could be use to resolve overlaps between "Barrier", "BarrierStart", and "BarrierEnd" meshes:

  • all three components are assigned a Tag "Barrier"
  • all three components are set to search for overlaps with components that have a Tag "Barrier" (Overlap Resolver->SearchTags set to "Barrier")
  • We adjusted the "Minimal Overlap Bounds Volume" which is useful to ignore minor overlaps, such as where objects just barely touch each other.
  • We assigned priorities to each component. The highest priority to "BarrierStart" and "BarrierEnd" and lower priority to "Barrier".

Once the Overlap Resolver is configured and the Path is regenerated, the meshes should not overlap anymore.

image

Debugging

When looking at the Path, it can be challenging to identify where overlaps occurred, especially when component placement is influenced by multiple systems such as randomization, spawning at interval, etc.

To help with debugging, we introduced a visualization mode that marks components in red, if they were removed due to an overlap, and in green, if they triggered the removal.

image

To enable the debug:

  1. Select the Path you want to debug
  2. Enable "Debug Overlap Resolver"
  3. Regenerate the Path.

image