Sites Editor - Zones
Sub-editor for managing zone polygon elements within the Sites Editor. Supports vertex selection/manipulation, plane editing, terrain snapping, and polygon-based containment testing.
Sub-editor for managing zone polygon elements within the Sites Editor. Supports vertex selection/manipulation, plane editing, terrain snapping, and polygon-based containment testing.
Class Methods
| Method | Description |
|---|---|
C:init(sitesEditor, key) | Initializes with parent editor reference |
C:setSites(sites) | Binds to sites data and zone list |
C:select(zone) | Selects a zone and clears vertex selection |
C:findVert(mouseInfo, objects) | Finds closest vertex under mouse cursor (renders spheres at each) |
C:tryInsert(mouseInfo) | Attempts to insert a new vertex at edge midpoints |
C:input(mouseInfo) | Handles shift-add, alt-insert, ctrl-multi-select, zone click-select |
C:updateTransform() | Updates gizmo from selected vertices or zone plane |
C:beginDrag() | Records pre-drag positions for undo |
C:dragging() | Translates/rotates selected vertices with optional terrain snap |
C:endDragging() | Commits vertex drag to undo history |
C:dropToTerrain(pos) | Projects a position onto the terrain surface height |
C:create() | Creates a new empty zone (with undo) |
C:remove(zone) | Removes a zone (with undo) |
C:drawElement(zone) | Draws zone property UI, vertex tools, planes, test containment button |
C:findZone(mouseInfo, objects) | Ray-intersects all zones, returns closest hit |
Example: Zone Polygon Editing
local zones = require('editor/sitesEditor/zones')
local zoneEditor = zones(sitesEditorRef, 'zones')
zoneEditor:setSites(currentSites)
-- Select a zone for editing
zoneEditor:select(someZone)
-- Zones are 3D polygons with vertices, a plane (height + normal), and a color
-- Vertex operations:
-- Shift+Click - add a new vertex at cursor position
-- Alt+Click - insert vertex at closest edge midpoint
-- Ctrl+Click - multi-select vertices
-- Click vertex - select single vertex
-- Zone properties:
-- name, color, customFields, tags
-- vertices: array of vec3 positions
-- plane: { origin, normal } defining the zone's flat surface
-- The "Test Containment" button spawns a debug sphere and checks
-- if a target point lies within the zone polygon
-- Terrain snap option: when enabled, vertex Z-values auto-snap to terrainModule Variables
windowDescription(string) - Module variable.
Module Variables
windowDescription(string) - Module variable.
See Also
- Sites Editor - Locations - Related reference
- Sites Editor - Parking Spots - Related reference
- Sites Editor - Sorted List Display - Related reference
- World Editor Guide - Guide
Sites Editor - Tags
Tag management sub-editor for the Sites Editor. Displays all tags in a two-column layout (has/doesn't-have), allowing bulk tag assignment and removal across elements.
Road Architect - Clothoid
Provides clothoid (Euler spiral) fitting for road nodes. Computes smooth curvature-continuous transitions between road segments using Fresnel integrals, with support for arc length parameterization an