Skip to content

Examples — Dynamic Floor Plugin

Examples

Concrete scenarios showing how to use the Dynamic Floor Plugin.


Example 1 — Explore the example map

The fastest way to understand the system.

  1. In the Content Browser, open: DynamicFloorPlugin/Maps/Preview_DynamicFloorPlugin
  2. Press Play.
  3. Left-click to place a floor tile. Right-click to abort. Press Shift to toggle fill mode.

From here, open the following Blueprints to see how everything is connected:

  • FloorPolyPluginPlayerController — controller setup and tool spawning
  • FloorPlacementControllerComponent — input routing
  • BP_ExampleRuntimeFloorPolygonToolActor — placement tool
  • BP_BoundaryActor — how walls become a node network
  • BP_FloorPolygonRenderer — how polygons become visible meshes

Example 2 — Place a single floor tile

Minimal code path for placing one rectangular tile at the cursor position.

What happens:

  1. Send an FFloorInputEvent with Kind = ClickPoint and ApplyMode = Commit to UFloorInputService.
  2. UClickPointResponsibilityHandler adds the tile polygon to UPolygonDatabase.
  3. UFloorPolygonChangeService notifies IFloorPolygonChangeListener objects.
  4. BP_FloorPolygonRenderer rebuilds the mesh section for that material.

Blueprint outline:

Get Game Instance Subsystem (DynamicFloorPluginSubsystem)
→ Get Floor Input Service
→ Handle Input Event
Kind: ClickPoint
Position: (cursor world position)
MaterialId: 1
FloorType: Default
ApplyMode: Commit

Example 3 — Room fill placement

Fill an entire room area defined by its walls.

Prerequisites:

  • A BP_BoundaryActor (or equivalent) has created a closed node network representing your room walls.

What happens:

  1. Send FFloorInputEvent with Kind = Fill and the cursor position inside the room.
  2. UFillEventResponsibilityHandler calls UNodeNetworkSubsystem.getNodeNetworkEnclosingPosition to find the enclosing network.
  3. The enclosed polygon is computed and added to UPolygonDatabase.
  4. Renderers are notified.

Node network setup (in a BoundaryActor or wall actor):

Get World Subsystem (NodeNetworkSubsystem)
For each wall endpoint / junction:
→ getOrCreateNodeAtPosition(position, NodeClass, NodeType=1, NodeMaterial=0)
For each pair of connected nodes:
→ NodeA.ConnectNode(NodeB)

The fill function will automatically detect the enclosed polygon once all wall nodes are connected.


Example 4 — Custom tool shape (triangle)

The default tool uses a rectangle. Here is how to use a triangle instead.

  1. Create a Blueprint subclass of BP_ExampleRuntimeFloorPolygonToolActor. Name it e.g. BP_TriangleFloorTool.

  2. Override Event BeginPlay in your subclass.

  3. In BeginPlay, set the ToolShape variable to your triangle:

    ToolShape = [
    (Vector: 0, 0, 0),
    (Vector: 100, 0, 0),
    (Vector: 50, 100, 0)
    ]

    (Adjust coordinates to match your desired triangle size and orientation.)

  4. Call the parent BeginPlay first (or after, as appropriate).

  5. Use BP_TriangleFloorTool wherever you previously used BP_ExampleRuntimeFloorPolygonToolActor.

The rest of the tool pipeline (hit detection, preview, commit) works identically.


Example 5 — Custom HUD with floor selector

Build your own HUD that lets the player pick a floor material and trigger placement.

HUD setup:

  1. Create a new Widget Blueprint for your HUD.
  2. Add a Place Floor button (or a material selector + place button).
  3. On button click:
    Get Player Controller
    → Call PlaceFloor(FloorType=Default, FloorMaterial=<selected material ID>)
  4. Make sure your Player Controller implements UiToControllerInterface and handles the PlaceFloor event by spawning a tool and calling SetActiveTool.

The example HUD is at DynamicFloorPlugin/Blueprints/ExampleGameplay/HUD — use it as a reference.


Example 6 — Polygon union (merging floor areas)

Merge several separate floor polygons into one unified shape using UFloorPolygonClipperLibrary.

Blueprint outline:

Get Polygon Database → GetPolygons
→ filter the polygons you want to merge
UFloorPolygonClipperLibrary → UnionPolygons(
InputPolygons: [polygonA, polygonB, polygonC],
Height: 0.0,
MaterialId: 1,
FloorType: Default
)
→ Result: TArray<FFloorPolygon> (merged output)
For each result polygon:
→ Get Polygon Database → InsertPolygonWithMaterialHandling(...)

Use DifferencePolygons for the opposite operation — cutting a shape out of existing polygons (e.g. removing a doorway from a floor).


Example 7 — Save and load floors

Persist the floor state between play sessions.

Save

Create Object of Class: UPolygonDatabaseSaveManager
→ SaveNodeSystem()
Create Object of Class: UNodeSystemDefaultSaveManager
→ SaveNodeSystem()

Load

Create Object of Class: UPolygonDatabaseSaveManager
→ LoadNodeSystem()
Create Object of Class: UNodeSystemDefaultSaveManager
→ LoadNodeSystem()

Save slots

ManagerSlot name
UPolygonDatabaseSaveManagerPolygonDatabaseSaveSlot
UNodeSystemDefaultSaveManagerNodeSystemSaveSlot

See also