Skip to content

editor_toolUtilities_profileSweep

File: lua/ge/extensions/editor/toolUtilities/profileSweep.lua · VM: Game Engine (GE) · 83 lines · BeamNG.drive 0.40.5 (buildbot 302427 on GitLab)

Access: extension editor_toolUtilities_profileSweep: extensions.load("editor_toolUtilities_profileSweep"), then the global editor_toolUtilities_profileSweep

Profile sweep: open 2D strips (lateral y, height z) are swept along a sequence of stations each carrying its own frame, to produce a single mesh per material. Unlike deckSweep, the frame is supplied by the caller (banked binormal and normal of a road), so the section rotates with the road. Stations are decimated according to a chord tolerance on the center and two key points of the section (meshRefine.decimateStations).

Notes

  • Depends on editor/toolUtilities/meshPart and editor/heroRoadEditor/meshRefine.
  • UVs are {arc length of station s, curvilinear abscissa along the strip}.

Functions

Function Description Line
editor_toolUtilities_profileSweep.at(a, y, z) World point of section point (y, z) at station a: a.pos + a.b * y + a.n * z. 22
editor_toolUtilities_profileSweep.build(st, strips, opts) Sweeps the strips along the stations. Each station: { x,y,z, bx,by,bz (transverse), nx,ny,nz (up), s (abscissa) }. Each strip: { pts = {{y,z},...}, nrm = {{ny,nz},...} (unit normals toward the visible face), mat }. The quadrilateral faces are generated by meshPart.face4n. 45

Parameter details

editor_toolUtilities_profileSweep.at(a, y, z)

World point of section point (y, z) at station a: a.pos + a.b * y + a.n * z.

  • a (table) : Station with x,y,z, bx,by,bz (transverse vector) and nx,ny,nz (up vector).
  • y (number) : Lateral offset in the section.
  • z (number) : Height in the section.
  • returns: table Point {x,y,z}.

editor_toolUtilities_profileSweep.build(st, strips, opts)

Sweeps the strips along the stations. Each station: { x,y,z, bx,by,bz (transverse), nx,ny,nz (up), s (abscissa) }. Each strip: { pts = {{y,z},...}, nrm = {{ny,nz},...} (unit normals toward the visible face), mat }. The quadrilateral faces are generated by meshPart.face4n.

  • st (table) : List of stations.
  • strips (table) : List of profile strips.
  • opts (table) : { tol, tolZ, maxSeg } for decimation, keyL and keyR = watched section points {y,z}.
  • returns: table|nil Parts (one per material); nil if fewer than 2 stations.
  • returns: table Indices of the kept stations.

tim19Atlas (Tim0219800) — derived from BeamNG GmbH Lua code (bCDDL 1.1, see LICENSE). Source: lua/ge/extensions/editor/toolUtilities/profileSweep.lua.