Class ScyllaArchwayShape
Parametric wall with an arched cutout: a rectangular bottom portion topped by a half-circle arch. The opening reaches the floor (door-like). Suitable for classical Roman archways, dungeon portals, and any prototype geometry where a curved opening reads better than a sharp-cornered rectangular doorway.
Inherited Members
Namespace: Scylla.Core.Util.Geom
Assembly: ScyllaCore.dll
Syntax
[AddComponentMenu("Scylla/Geometry/Archway")]
public sealed class ScyllaArchwayShape : ScyllaShapeBase3D
Remarks
Topology: the front and back faces each split into a left jamb (full wall height, optional), a right jamb (full wall height, optional), and an above-arch region triangulated as ArchSegments vertical strips between the arch curve and the wall top. The top face is a single quad; the bottom face splits into left and right segments (door reaches floor); the two end faces are single quads. The interior of the cutout has up to four pieces: a flat rectangular left jamb (if the rectangular portion has positive height), a flat rectangular right jamb, and a curved arch interior tessellated with ArchSegments quads forming a half-cylinder strip.
The half-circle arch is parameterized as archPoint(θ) = (archCenterX + R *
cos(θ), springline + R * sin(θ)) with θ sweeping from π at the
left springer through π/2 at the apex to 0 at the right springer.
The strip between adjacent arch points archPoint(θ_i) /
archPoint(θ_i+1) and their projections onto wallTop is emitted as a
trapezoidal planar quad (the bottom edge follows the arch chord; the top edge is
horizontal at wallTop; the two side edges are vertical). All emitted quads
pass the standard (v1-v0) x (v2-v0) outward-winding contract.
Build-time clamping: OpeningWidth is clamped so the half-circle fits
within the wall height (R = min(OpeningWidth, 2 * WallHeight) * 0.5); the
rectangular portion's height is clamped to [0, WallHeight - R] so the arch
apex never exceeds the wall's top; OffsetX is clamped so the opening
fits horizontally. No bevel in v1.
Properties
ArchSegments
Number of quads used to tessellate the half-circle arch. Higher values produce a smoother
curve and more facets in the curved arch interior strip. Clamped to [2, 64]
when set and at build time. Setting this property triggers an immediate mesh rebuild via
Rebuild().
Declaration
public int ArchSegments { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
OffsetX
Horizontal offset of the opening's center from the wall's center along the X axis in world units. Clamped at build time so the opening's left and right edges remain within the wall's extents. Setting this property triggers an immediate mesh rebuild via Rebuild().
Declaration
public float OffsetX { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
OpeningHeight
Height of the straight rectangular portion of the opening below the half-circle (the
springline height above the floor) in world units. Set to 0 for a pure semicircle
opening that begins at floor level. Clamped so the arch apex never exceeds the wall top.
Setting this property triggers an immediate mesh rebuild via Rebuild().
Declaration
public float OpeningHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
OpeningWidth
Width of the arched opening in world units. This value also determines the half-circle
radius as OpeningWidth * 0.5. Clamped at build time so the arch fits both
horizontally within the wall and vertically so the apex does not exceed the wall's top.
Setting this property triggers an immediate mesh rebuild via Rebuild().
Declaration
public float OpeningWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
WallHeight
Wall extent along the Y axis in world units. Controls the wall's standing height.
Values below 0.0001 are clamped when set and at build time.
Setting this property triggers an immediate mesh rebuild via Rebuild().
Declaration
public float WallHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
WallLength
Wall extent along the X axis in world units. Controls how long the wall is.
Values below 0.0001 are clamped when set and at build time.
Setting this property triggers an immediate mesh rebuild via Rebuild().
Declaration
public float WallLength { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
WallThickness
Wall extent along the Z axis in world units. Controls how deep (thick) the wall slab is
perpendicular to its face. Values below 0.0001 are clamped when set and at build time.
Setting this property triggers an immediate mesh rebuild via
Rebuild().
Declaration
public float WallThickness { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Methods
Build(Mesh, float, float, float, float, float, int, float, IFaceColorResolver)
Populates target with a parametric archway mesh. Existing mesh data is
overwritten. All parameters are clamped at build time so the opening always fits within the
wall (see the class remarks for the full clamp and topology details).
Declaration
public static void Build(Mesh target, float wallLength, float wallHeight, float wallThickness, float openingWidth, float openingHeight, int archSegments, float offsetX, IFaceColorResolver resolver = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Mesh | target | Destination mesh to populate. Must be non-null. |
| float | wallLength | Wall extent along the X axis in world units. Clamped to a minimum of |
| float | wallHeight | Wall extent along the Y axis in world units. Clamped to a minimum of |
| float | wallThickness | Wall extent along the Z axis in world units. Clamped to a minimum of |
| float | openingWidth | Width of the arch opening in world units. Also defines the half-circle radius
( |
| float | openingHeight | Height of the straight rectangular portion below the half-circle (the springline height above the floor) in world units. Clamped so the arch apex stays below the wall's top. |
| int | archSegments | Number of quads tessellating the half-circle arch. Clamped to [ |
| float | offsetX | Horizontal offset of the opening's center from the wall's center along the X axis in world units. Clamped so the opening fits within the wall. |
| IFaceColorResolver | resolver | Optional per-face color resolver. When non-null, a per-vertex color channel is emitted
with one solid color per emitted quad; each above-arch trapezoidal strip and each curved
arch interior strip quad counts as its own face. When |
BuildMesh(Mesh)
Subclass extension point: write vertex / triangle / normal / uv data into
target from the shape's serialized parameters. The base class
calls Clear(bool) before invoking this method and
UnityEngine.Mesh.RecalculateBounds() afterwards, so subclasses should not invoke
either themselves.
Declaration
protected override void BuildMesh(Mesh target)
Parameters
| Type | Name | Description |
|---|---|---|
| Mesh | target | The owned mesh to populate. Already cleared by the base class. |
Overrides
GetMeshName()
Returns the shape's mesh name as it should appear on the generated mesh asset. Defaults to the subclass type name; override to provide a friendlier label.
Declaration
protected override string GetMeshName()
Returns
| Type | Description |
|---|---|
| string | A short identifier for the generated mesh, used as UnityEngine.Object.name. |
Overrides
TryAttachPrimitiveCollider()
Subclass extension point: when ColliderMode is
MatchingPrimitive, obtain the appropriate primitive
collider through GetOrAddManagedCollider<T>(), size it to the current
parameters, and return true. Return false to let the base class fall
back to UnityEngine.MeshCollider.
Declaration
protected override bool TryAttachPrimitiveCollider()
Returns
| Type | Description |
|---|---|
| bool |
|
Overrides
Remarks
Runs on every rebuild. Always go through GetOrAddManagedCollider<T>()
rather than AddComponent: it reuses the collider from the previous rebuild,
so the override only has to update its size and center. A collider added directly
is not tracked by the shape and a new one would be added on every rebuild.