Road Architect - Profiles
Manages road cross-section profiles in the Road Architect. Profiles define the lateral structure of a road: lane widths, layer materials, shoulder/curb geometry, and elevation offsets. Supports profil
Manages road cross-section profiles in the Road Architect. Profiles define the lateral structure of a road: lane widths, layer materials, shoulder/curb geometry, and elevation offsets. Supports profile templates, copying, and per-node profile interpolation.
Public Functions
| Function | Signature | Description |
|---|---|---|
M.profiles | `` | Profiles data table |
M.getMinMaxLaneKeys | (...) | Gets min/max lane key indices |
M.updateLaneFlags | (...) | Updates lane flags |
M.getLaneFlags | (...) | Gets lane flags |
M.removeLayer | (...) | Removes a profile layer |
M.layerChangePriority | (...) | Changes layer priority |
M.addLayer | (...) | Adds a profile layer |
M.getIdFromName | (...) | Gets profile ID from name |
M.getProfileFromName | (...) | Gets profile from name |
M.cycleLaneType | (...) | Cycles lane type forward |
M.cycleLaneTypeBack | (...) | Cycles lane type backward |
M.computeLaneKeys | (...) | Computes lane keys |
M.getOrderedLanes | (...) | Gets lanes in order |
M.getNumLanesLR | (...) | Gets number of lanes left/right |
M.getNumRoadLanesLR | (...) | Gets number of road lanes left/right |
M.isProfileValidForMidJctPerfect | (...) | Checks if profile is valid for perfect mid-junction |
M.areSidewalksPresent | (...) | Checks if sidewalks are present |
M.getWAndHByKey | (...) | Gets width and height by key |
M.getWidth | (...) | Gets profile width |
M.removeAllTempCurrentProfiles | () | Removes all temporary current profiles |
M.autoPaintLines | (...) | Auto-paints lane lines |
M.autoEdgeBlending | (...) | Auto-blends edges |
M.addCenterline | (...) | Adds centerline marking |
M.addEdgeLines | (...) | Adds edge line markings |
M.addEndLine | (...) | Adds end line marking |
M.addLaneDivisionLines | (...) | Adds lane division line markings |
M.addLightTreadToLanes | (...) | Adds light tread to lanes |
M.createTemplateOnRequest | (...) | Creates a template profile on request |
M.computeSectionsByType | (...) | Computes sections grouped by type |
M.createCustomImportProfile | (...) | Creates a custom import profile |
M.createProfileFromTemplate | (...) | Creates a profile from template |
M.createProfileFromDecalData | (...) | Creates a profile from decal data |
M.createOverlayProfile | (...) | Creates an overlay profile |
M.createBridgeProfile | (...) | Creates a bridge profile |
M.createProfileForJctRoad | (...) | Creates a profile for junction road |
M.createProfileForJctRoadYSpecial | (...) | Creates a profile for Y-junction special road |
M.createProfileForJctRoad1Way | (...) | Creates a profile for one-way junction road |
M.createProfileForJctRoad_SW | (...) | Creates a profile for junction road with sidewalk |
M.createSidewalkOnlyProfile | (...) | Creates a sidewalk-only profile |
M.createRoundaboutProfile | (...) | Creates a roundabout profile |
Example: Profile Configuration
local profiles = require('editor/tech/roadArchitect/profiles')
-- Create a default 2-lane profile
local profile = profiles.createDefaultProfile()
-- Or from a template
local highwayProfile = profiles.createProfileFromTemplate("4-Lane Highway")
-- Add lanes
profiles.addLane(profile, 'right', { width = 3.5, type = 'driving' })
profiles.addLane(profile, 'left', { width = 2.0, type = 'shoulder' })
-- Set lane width
profiles.setLaneWidth(profile, 'R1', 4.0)
-- Add a material layer (e.g., asphalt surface)
profiles.addLayer(profile, { name = 'surface', material = 'road_asphalt_01' })
-- Compute lateral offsets for geometry generation
local offsets = profiles.computeLateralOffsets(profile)
-- Apply profile to a road
profiles.applyProfile(road, profile)
-- Profile templates available:
local templates = profiles.getTemplateNames()
-- e.g., "2-Lane Road", "4-Lane Highway", "Dirt Path", "Sidewalk"
-- Interpolation for smooth profile transitions between nodes
local blended = profiles.interpolateProfiles(profileA, profileB, 0.5)Notes
- Lane keys follow convention: L1, L2, ... (left) and R1, R2, ... (right)
- Layers define vertical stacking (surface, base, sub-base)
- Each layer has: material, thickness, lateral span, display toggle
- Profile interpolation enables variable-width roads
Functions
getMinMaxLaneKeys(profile)
Returns the min max lane keys.
profile(any)
Returns: l, u
updateLaneFlags(p)
Updates lane flags.
p(any)
getLaneFlags()
Returns the lane flags.
Returns: table
layerChangePriority(p, i, dir)
Handles layer change priority.
p(any)i(number)dir(string)
getIdFromName(name)
Returns the id from name.
name(string)
Returns: nil
getProfileFromName(name)
Returns the profile from name.
name(string)
cycleLaneType(t)
Handles cycle lane type.
t(any)
Returns: t
cycleLaneTypeBack(t)
Handles cycle lane type back.
t(any)
Returns: t
getOrderedLanes(profile)
Returns the ordered lanes.
profile(any)
Returns: lanes, ctr - 1
getNumLanesLR(profile)
Returns the num lanes lr.
profile(any)
Returns: numLeft, numRight
getNumRoadLanesLR(profile)
Returns the num road lanes lr.
profile(any)
Returns: numLeft, numRight
isProfileValidForMidJctPerfect(profile)
Checks if profile valid for mid jct perfect.
profile(any)
Returns: boolean - true
areSidewalksPresent(p)
Handles are sidewalks present.
p(any)
Returns: boolean - false
getWAndHByKey(profile)
Returns the w and h by key.
profile(any)
Returns: widths, heightsL, heightsR
getWidth(profile)
Returns the width.
profile(any)
Returns: width
removeAllTempCurrentProfiles()
Removes all temp current profiles.
autoPaintLines(prof)
Handles auto paint lines.
prof(any)
autoEdgeBlending(prof, isLeft, isRight, mat)
Handles auto edge blending.
prof(any)isLeft(any)isRight(any)mat(any)
addCenterline(p, isPaint)
Adds centerline.
p(any)isPaint(any)
addEdgeLines(p, latOffL, latOffR, isLeft, isRight, isPaint)
Adds edge lines.
p(any)latOffL(any)latOffR(any)isLeft(any)isRight(any)isPaint(any)
addEndLine(p, isStart, isEnd)
Adds end line.
p(any)isStart(any)isEnd(any)
addLaneDivisionLines(p, isPaint)
Adds lane division lines.
p(any)isPaint(any)
addLightTreadToLanes(p, fadeS, fadeE, lMin, lMax)
Adds light tread to lanes.
p(any)fadeS(any)fadeE(any)lMin(any)lMax(any)
createTemplateOnRequest(p)
Creates template on request.
p(any)
computeSectionsByType(profile, laneType1, laneType2)
Computes sections by type.
profile(any)laneType1(any)laneType2(any)
Returns: sections
createCustomImportProfile(lanes)
Creates custom import profile.
lanes(any)
Returns: profile, lNew
createProfileFromDecalData(numLeftLanes, numRightLanes)
Creates profile from decal data.
numLeftLanes(any)numRightLanes(any)
Returns: profile
createOverlayProfile(width)
Creates overlay profile.
width(any)
Returns: profile
createBridgeProfile(width, depth)
Creates bridge profile.
width(any)depth(number)
Returns: profile
createProfileForJctRoad(numLeftLanes, numRightLanes, width, sidewalkWidth, sidewalkHeight, isSidewalk, mat)
Creates profile for jct road.
numLeftLanes(any)numRightLanes(any)width(any)sidewalkWidth(any)sidewalkHeight(any)isSidewalk(any)mat(any)
Returns: profile
createProfileForJctRoadYSpecial(numLeftLanes, numRightLanes, width, sidewalkWidth, sidewalkHeight, isSidewalk, isFlipKerb, mat)
Creates profile for jct road y special.
numLeftLanes(any)numRightLanes(any)width(any)sidewalkWidth(any)sidewalkHeight(any)isSidewalk(any)isFlipKerb(any)mat(any)
Returns: profile
createProfileForJctRoad1Way(numLanes, width, sidewalkWidth, sidewalkHeight, isSidewalk, mat)
Creates profile for jct road1way.
numLanes(any)width(any)sidewalkWidth(any)sidewalkHeight(any)isSidewalk(any)mat(any)
Returns: profile
createProfileForJctRoad_SW(numLeftLanes, numRightLanes, width, sidewalkWidth, sidewalkHeight, isLeftSide, mat)
Creates profile for jct road_sw.
numLeftLanes(any)numRightLanes(any)width(any)sidewalkWidth(any)sidewalkHeight(any)isLeftSide(any)mat(any)
Returns: profile
createSidewalkOnlyProfile(sidewalkWidth, sidewalkHeight, isFlipKerb)
Creates sidewalk only profile.
sidewalkWidth(any)sidewalkHeight(any)isFlipKerb(any)
Returns: profile
createRoundaboutProfile(numRBLanes, laneWidthRB, mat)
Creates roundabout profile.
numRBLanes(any)laneWidthRB(any)mat(any)
Returns: profile
createProfileForJctRoadHwyCap(numLanes, laneWidth, cResWidth, hardWidth, mat)
Creates profile for jct road hwy cap.
numLanes(any)laneWidth(any)cResWidth(any)hardWidth(any)mat(any)
Returns: profile
createProfileForJctRoadHwyCapUrban(numLanes, laneWidth, isSidewalk, sidewalkWidth, sidewalkHeight, isOneWay, mat)
Creates profile for jct road hwy cap urban.
numLanes(any)laneWidth(any)isSidewalk(any)sidewalkWidth(any)sidewalkHeight(any)isOneWay(any)mat(any)
Returns: profile
createProfileForJctRoadHwyUrbanTrans(numLanes, laneWidth, cResWidth, hardWidth, isOneWay, mat)
Creates profile for jct road hwy urban trans.
numLanes(any)laneWidth(any)cResWidth(any)hardWidth(any)isOneWay(any)mat(any)
Returns: profile
createProfileForJctRoadHwyCap1W(numLanes, laneWidth, hardWidth, mat)
Creates profile for jct road hwy cap1w.
numLanes(any)laneWidth(any)hardWidth(any)mat(any)
Returns: profile
createProfileForJctRoadHwyS2(numLanes, laneWidth, cResWidth, hardWidth, mat)
Creates profile for jct road hwy s2.
numLanes(any)laneWidth(any)cResWidth(any)hardWidth(any)mat(any)
Returns: profile
createProfileForJctRoadHwyS3(numLanes, laneWidth, cResWidth, hardWidth, mat)
Creates profile for jct road hwy s3.
numLanes(any)laneWidth(any)cResWidth(any)hardWidth(any)mat(any)
Returns: profile
createProfileForJctRoadHwyExit(laneWidth, hardWidth, mat)
Creates profile for jct road hwy exit.
laneWidth(any)hardWidth(any)mat(any)
Returns: profile
updateToNewTemplate(road, templateName)
Updates to new template.
road(any)templateName(any)
goToProfileView(timer, time)
Handles go to profile view.
timer(any)time(any)
Returns: time
goToOldView()
Handles go to old view.
applyMasterWidth(profile, mWidth)
Handles apply master width.
profile(any)mWidth(any)
populateProfileTemplates()
Handles populate profile templates.
Returns: -- If the profiles already exist, do not re-create them.
resetTemplates()
Handles reset templates.
Returns: self
updateCondition(r)
Updates condition.
r(any)
serialiseProfile(p)
Handles serialise profile.
p(any)
Returns: pSer
deserialiseProfile(pSer)
Handles deserialise profile.
pSer(any)
Returns: p
load()
Handles load.
Functions
getMinMaxLaneKeys(profile)
Returns the min max lane keys.
profile(any)
Returns: l, u
updateLaneFlags(p)
Updates lane flags.
p(any)
getLaneFlags()
Returns the lane flags.
Returns: table
layerChangePriority(p, i, dir)
Handles layer change priority.
p(any)i(number)dir(string)
getIdFromName(name)
Returns the id from name.
name(string)
Returns: nil
getProfileFromName(name)
Returns the profile from name.
name(string)
cycleLaneType(t)
Handles cycle lane type.
t(any)
Returns: t
cycleLaneTypeBack(t)
Handles cycle lane type back.
t(any)
Returns: t
getOrderedLanes(profile)
Returns the ordered lanes.
profile(any)
Returns: lanes, ctr - 1
getNumLanesLR(profile)
Returns the num lanes lr.
profile(any)
Returns: numLeft, numRight
getNumRoadLanesLR(profile)
Returns the num road lanes lr.
profile(any)
Returns: numLeft, numRight
isProfileValidForMidJctPerfect(profile)
Checks if profile valid for mid jct perfect.
profile(any)
Returns: boolean - true
areSidewalksPresent(p)
Handles are sidewalks present.
p(any)
Returns: boolean - false
getWAndHByKey(profile)
Returns the w and h by key.
profile(any)
Returns: widths, heightsL, heightsR
getWidth(profile)
Returns the width.
profile(any)
Returns: width
removeAllTempCurrentProfiles()
Removes all temp current profiles.
autoPaintLines(prof)
Handles auto paint lines.
prof(any)
autoEdgeBlending(prof, isLeft, isRight, mat)
Handles auto edge blending.
prof(any)isLeft(any)isRight(any)mat(any)
addCenterline(p, isPaint)
Adds centerline.
p(any)isPaint(any)
addEdgeLines(p, latOffL, latOffR, isLeft, isRight, isPaint)
Adds edge lines.
p(any)latOffL(any)latOffR(any)isLeft(any)isRight(any)isPaint(any)
addEndLine(p, isStart, isEnd)
Adds end line.
p(any)isStart(any)isEnd(any)
addLaneDivisionLines(p, isPaint)
Adds lane division lines.
p(any)isPaint(any)
addLightTreadToLanes(p, fadeS, fadeE, lMin, lMax)
Adds light tread to lanes.
p(any)fadeS(any)fadeE(any)lMin(any)lMax(any)
createTemplateOnRequest(p)
Creates template on request.
p(any)
computeSectionsByType(profile, laneType1, laneType2)
Computes sections by type.
profile(any)laneType1(any)laneType2(any)
Returns: sections
createCustomImportProfile(lanes)
Creates custom import profile.
lanes(any)
Returns: profile, lNew
createProfileFromDecalData(numLeftLanes, numRightLanes)
Creates profile from decal data.
numLeftLanes(any)numRightLanes(any)
Returns: profile
createOverlayProfile(width)
Creates overlay profile.
width(any)
Returns: profile
createBridgeProfile(width, depth)
Creates bridge profile.
width(any)depth(number)
Returns: profile
createProfileForJctRoad(numLeftLanes, numRightLanes, width, sidewalkWidth, sidewalkHeight, isSidewalk, mat)
Creates profile for jct road.
numLeftLanes(any)numRightLanes(any)width(any)sidewalkWidth(any)sidewalkHeight(any)isSidewalk(any)mat(any)
Returns: profile
createProfileForJctRoadYSpecial(numLeftLanes, numRightLanes, width, sidewalkWidth, sidewalkHeight, isSidewalk, isFlipKerb, mat)
Creates profile for jct road y special.
numLeftLanes(any)numRightLanes(any)width(any)sidewalkWidth(any)sidewalkHeight(any)isSidewalk(any)isFlipKerb(any)mat(any)
Returns: profile
createProfileForJctRoad1Way(numLanes, width, sidewalkWidth, sidewalkHeight, isSidewalk, mat)
Creates profile for jct road1way.
numLanes(any)width(any)sidewalkWidth(any)sidewalkHeight(any)isSidewalk(any)mat(any)
Returns: profile
createProfileForJctRoad_SW(numLeftLanes, numRightLanes, width, sidewalkWidth, sidewalkHeight, isLeftSide, mat)
Creates profile for jct road_sw.
numLeftLanes(any)numRightLanes(any)width(any)sidewalkWidth(any)sidewalkHeight(any)isLeftSide(any)mat(any)
Returns: profile
createSidewalkOnlyProfile(sidewalkWidth, sidewalkHeight, isFlipKerb)
Creates sidewalk only profile.
sidewalkWidth(any)sidewalkHeight(any)isFlipKerb(any)
Returns: profile
createRoundaboutProfile(numRBLanes, laneWidthRB, mat)
Creates roundabout profile.
numRBLanes(any)laneWidthRB(any)mat(any)
Returns: profile
createProfileForJctRoadHwyCap(numLanes, laneWidth, cResWidth, hardWidth, mat)
Creates profile for jct road hwy cap.
numLanes(any)laneWidth(any)cResWidth(any)hardWidth(any)mat(any)
Returns: profile
createProfileForJctRoadHwyCapUrban(numLanes, laneWidth, isSidewalk, sidewalkWidth, sidewalkHeight, isOneWay, mat)
Creates profile for jct road hwy cap urban.
numLanes(any)laneWidth(any)isSidewalk(any)sidewalkWidth(any)sidewalkHeight(any)isOneWay(any)mat(any)
Returns: profile
createProfileForJctRoadHwyUrbanTrans(numLanes, laneWidth, cResWidth, hardWidth, isOneWay, mat)
Creates profile for jct road hwy urban trans.
numLanes(any)laneWidth(any)cResWidth(any)hardWidth(any)isOneWay(any)mat(any)
Returns: profile
createProfileForJctRoadHwyCap1W(numLanes, laneWidth, hardWidth, mat)
Creates profile for jct road hwy cap1w.
numLanes(any)laneWidth(any)hardWidth(any)mat(any)
Returns: profile
createProfileForJctRoadHwyS2(numLanes, laneWidth, cResWidth, hardWidth, mat)
Creates profile for jct road hwy s2.
numLanes(any)laneWidth(any)cResWidth(any)hardWidth(any)mat(any)
Returns: profile
createProfileForJctRoadHwyS3(numLanes, laneWidth, cResWidth, hardWidth, mat)
Creates profile for jct road hwy s3.
numLanes(any)laneWidth(any)cResWidth(any)hardWidth(any)mat(any)
Returns: profile
createProfileForJctRoadHwyExit(laneWidth, hardWidth, mat)
Creates profile for jct road hwy exit.
laneWidth(any)hardWidth(any)mat(any)
Returns: profile
updateToNewTemplate(road, templateName)
Updates to new template.
road(any)templateName(any)
goToProfileView(timer, time)
Handles go to profile view.
timer(any)time(any)
Returns: time
goToOldView()
Handles go to old view.
applyMasterWidth(profile, mWidth)
Handles apply master width.
profile(any)mWidth(any)
populateProfileTemplates()
Handles populate profile templates.
Returns: -- If the profiles already exist, do not re-create them.
resetTemplates()
Handles reset templates.
Returns: self
updateCondition(r)
Updates condition.
r(any)
serialiseProfile(p)
Handles serialise profile.
p(any)
Returns: pSer
deserialiseProfile(pSer)
Handles deserialise profile.
pSer(any)
Returns: p
load()
Handles load.
Additional Exports
M.applyMasterWidthM.copyProfileM.createProfileForJctRoadHwyCapM.createProfileForJctRoadHwyCap1WM.createProfileForJctRoadHwyCapUrbanM.createProfileForJctRoadHwyExitM.createProfileForJctRoadHwyS2M.createProfileForJctRoadHwyS3M.createProfileForJctRoadHwyUrbanTransM.deserialiseProfileM.goToOldViewM.goToProfileViewM.loadM.populateProfileTemplatesM.removeLaneM.resetTemplatesM.saveM.serialiseProfileM.updateConditionM.updateToNewTemplateM.addLane
See Also
- Road Architect - Clothoid - Related reference
- Road Architect - Decals - Related reference
- Road Architect - Export - Related reference
- World Editor Guide - Guide
Road Architect - Overlays
Manages road overlay elements in the Road Architect. Overlays are textured patches placed on top of road surfaces (e.g., crosswalks, road markings, patches). Handles overlay creation, positioning, mat
Road Architect - Render
Handles all editor viewport rendering for the Road Architect. Draws road surfaces, outlines, centerlines, lane numbering, direction arrows, node spheres, guidelines, layer visualizations, junctions, l