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:
- Spawn the actor
- Set start and end points each frame as the cursor moves
- Finalize when the player confirms the placement
- 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
LineTraceSingleByChannelwithECC_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 WallUse 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 WallWallActor -> Positioning FinalisedPositioning 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:
- After placing a new wall, check whether its start or end point is near another wall (use a small box or sphere overlap).
- If a neighbor is found, set the neighbor references on both walls.
- Call
Construct Wallon both walls to rebuild the shared corner geometry.
Wall actor properties
| Property | Type | Default | Description |
|---|---|---|---|
wall_height | float | 200.0 | Wall height in cm. Pass on spawn or set after spawning. |
wall_width | float | 20.0 | Wall width in cm. Pass on spawn or set after spawning. |
end_point | FVector | — | End world position. Set via Set Start And End or Set End Point. |
WallState | EWallState | Building | Building until Positioning Finalised is called. |
WallMaterial | UMaterialInterface | — | Must be assigned for the wall to be visible. |
wall_painter_material | UMaterialInterface | — | Required for paint features. |
Blueprint-callable functions on AWallLineActor
| Function | Description |
|---|---|
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 Wall | Rebuilds the wall mesh. Call after changing start or end. |
Positioning Finalised | Marks 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 locationThis 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.
Related pages
- Build Mode — editor-side placement
- Doors and Windows — adding reveals at runtime
- Grid and Snapping — snap details