Grid & Snapping — Dynamic Floor Plugin
Grid & Snapping
The Dynamic Floor Plugin does not include built-in grid snapping. However, it provides a dedicated hook where you can implement any positional constraint — grid snapping, vertex snapping, or anything else.
The hook: FindValidHitResult
FindValidHitResult is a function in BP_ExampleRuntimeFloorPolygonToolActor (and any subclass). It receives the raw cursor hit result and returns a validated, optionally transformed position.
Its intended purpose from the official documentation:
“Used to find a valid hit result from the cursor. Can also be used to apply a grid or something.”
The position returned by FindValidHitResult is the position used for:
- Moving the tool preview (via
ShowTool) - Creating/finding nodes at that position (via
UNodeNetworkSubsystem.getOrCreateNodeAtPosition) - Committing the polygon to the database
How to implement grid snapping
1. Subclass the tool
Create a Blueprint subclass of BP_ExampleRuntimeFloorPolygonToolActor.
2. Override FindValidHitResult
In your subclass, override FindValidHitResult. Inside it:
- Get the raw hit position from the input hit result.
- Round the X and Y components to your grid size:
SnappedX = Round(RawX / GridSize) * GridSizeSnappedY = Round(RawY / GridSize) * GridSizeZ = RawZ (or a fixed height)
- Return the snapped position as the valid hit result.
The rest of the tool pipeline will automatically use the snapped position.
How the snapped position flows downstream
Once FindValidHitResult returns a position:
ShowToolmoves the tool preview to that position.- On commit (left-click), the position is sent as
FFloorInputEvent.Position. UNodeNetworkSubsystem.getOrCreateNodeAtPositionuses the position to find or create a node — meaning nodes snap to the exact same grid coordinate automatically if two snapped positions are identical.
This means grid snapping also causes node sharing: two wall segments that end on the same grid point will automatically share a node — which is the correct behaviour for a room boundary network.
Vertex snapping (snapping to existing nodes)
The UNodeNetworkSubsystem.getOrCreateNodeAtPosition function returns an existing node if one is already at that position. This means that if your snapped position coincides with an existing node’s position, it will reuse that node rather than creating a new one. This is effectively automatic vertex snapping for grid-aligned positions.
For free-form vertex snapping (snap to nearest node regardless of grid), you would need to query nearby nodes and round to the nearest one’s position manually.
Other uses of FindValidHitResult
The same hook can be used for:
- Height snapping — lock Z position to fixed floor levels (e.g. floor 1 at Z=0, floor 2 at Z=300)
- Surface constraints — only allow placement on certain surface types (filter by hit component or material)
- Exclusion zones — reject hits in restricted areas by returning an invalid result
See also
- Floor Placement — how
FindValidHitResultfits into the full pipeline - Examples — example scenarios