Skip to content

Wall Placement (Runtime) — Wall Plugin

Wall Placement – Runtime Workflow

This page describes how to spawn, position, and finalize walls at runtime from Blueprint or C++. This is the foundation for building a player-facing construction system (e.g. Sims-style building mode).


Overview

A wall is an AWallLineActor. To place a wall at runtime:

  1. Spawn the actor
  2. Set start and end points each frame as the cursor moves
  3. Finalize when the player confirms the placement
  4. Optionally link it to neighboring walls

Step 1 – Find the placement position

Perform a line trace from the camera through the cursor to find the world position on the floor or another surface:

  • Use a standard LineTraceSingleByChannel with ECC_Visibility.
  • For walls, the relevant position is the bottom center of the wall (floor level).

Step 2 – Spawn the wall actor

Spawn PlaceableWall_BP (the Blueprint child of AWallLineActor) at the desired start position:

SpawnActor -> PlaceableWall_BP
Location: (first hit location)
Expose on spawn:
wall_height: (desired height, e.g. 260)
wall_width: (desired width, e.g. 20)

wall_height and wall_width are exposed-on-spawn so you can pass them directly on the spawn call.


Step 3 – Update start and end each frame

While the player is still choosing the end position, update the wall every tick:

WallActor -> Set Start And End
Start: (first hit location)
End: (current cursor hit location)
WallActor -> Construct Wall

Use Set Start And End rather than calling Set Start Point and Set End Point separately — it avoids redundant mesh rebuilds.


Step 4 – Finalize the wall

When the player confirms the end position (e.g. second click):

WallActor -> Set Start And End
Start: (start point)
End: (confirmed end point)
WallActor -> Construct Wall
WallActor -> Positioning Finalised

Positioning Finalised transitions the wall from Building to Finalized state. After this, the wall is considered permanent.


Step 5 – Connect walls at corners (optional)

To create a seamless corner between two walls:

  1. After placing a new wall, check whether its start or end point is near another wall (use a small box or sphere overlap).
  2. If a neighbor is found, set the neighbor references on both walls.
  3. Call Construct Wall on both walls to rebuild the shared corner geometry.

Wall actor properties

PropertyTypeDefaultDescription
wall_heightfloat200.0Wall height in cm. Pass on spawn or set after spawning.
wall_widthfloat20.0Wall width in cm. Pass on spawn or set after spawning.
end_pointFVectorEnd world position. Set via Set Start And End or Set End Point.
WallStateEWallStateBuildingBuilding until Positioning Finalised is called.
WallMaterialUMaterialInterfaceMust be assigned for the wall to be visible.
wall_painter_materialUMaterialInterfaceRequired for paint features.

Blueprint-callable functions on AWallLineActor

FunctionDescription
Set Start And End (start, end)Sets both endpoints in one call. Preferred over setting them separately.
Set Start Point (start)Sets the wall’s start point (= actor location).
Set End Point (end)Sets the wall’s end point.
Construct WallRebuilds the wall mesh. Call after changing start or end.
Positioning FinalisedMarks the wall as finalized.
Is Finalized (Pure)Returns true if the wall is in Finalized state.
Convert To Bottom Center Position (location, merge_if_under)Snaps a world position to the wall’s bottom center. Useful for snap logic.

Example: detect and snap to existing walls

During placement, when the cursor trace hits an AWallLineActor:

HitActor -> Convert To Bottom Center Position
Location: (hit location)
Merge If Under: 50.0 ← snaps to the wall center if within 50 cm
→ use result as the endpoint instead of the raw hit location

This is the same snap logic used by the editor’s Place Wall mode.


Example: the PluginExampleController_BP

The plugin ships with an example controller Blueprint (PluginExampleController_BP) that demonstrates the runtime placement workflow — including reveal dragging. It is used in the example test map.