Class ScyllaLinearStairsShape
Parametric straight flight of stairs: a closed solid of StepCount equal steps ascending along +Z and +Y. Each step contributes a horizontal tread and a vertical riser; the solid is closed by a bottom face, a vertical back face, and (when BuildSides is set) two staircase-profile side walls.
Inheritance
Inherited Members
Namespace: Scylla.Core.Util.Geom
Assembly: ScyllaCore.dll
Syntax
[AddComponentMenu("Scylla/Geometry/Linear Stairs")]
public sealed class ScyllaLinearStairsShape : ScyllaShapeBase3D
Remarks
The mesh is centered on the origin: it spans width on X, the total rise
(StepCount * StepHeight) on Y, and the total run (StepCount * StepDepth)
on Z. The first riser rises from the floor (-totalRise/2); the last tread sits
at +totalRise/2.
When BuildSides is false the two side profiles are omitted, which
is appropriate for a staircase embedded between two walls (the open sides are never
seen). The collider always falls back to a UnityEngine.MeshCollider because no
primitive matches the stepped silhouette.
For per-face coloring, ColoringMode selects between TreadsAndStructure (default, 2 resolver indices: structure = bottom + back + side columns, treads = the horizontal step tops AND the vertical risers - i.e. the "step face" you see when looking at the staircase) and PerStep (one resolver call per emitted face, the original busier look).
Properties
BuildSides
When true, emits the two staircase-profile side walls so the flight is
fully closed on all sides. Set to false when the flight is embedded between
walls and the side faces will never be seen. Setting this triggers an immediate mesh rebuild.
Declaration
public bool BuildSides { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
ColoringMode
Selects the per-face color granularity. Geometry is identical in all modes; only how many distinct resolver indices the staircase emits changes. Setting this triggers an immediate mesh rebuild.
Declaration
public StairsColoringMode ColoringMode { get; set; }
Property Value
| Type | Description |
|---|---|
| StairsColoringMode |
StepCount
Number of steps in the staircase flight. Clamped to [1, 128] when set and at build time.
Setting this triggers an immediate mesh rebuild.
Declaration
public int StepCount { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
StepDepth
Horizontal depth (run) of each tread along Z, in world units. Floored to
0.0001 when set and at build time. Setting this triggers an immediate mesh rebuild.
Declaration
public float StepDepth { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
StepHeight
Vertical rise of each individual step along Y, in world units. Floored to
0.0001 when set and at build time. Setting this triggers an immediate mesh rebuild.
Declaration
public float StepHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Width
Width of the entire staircase flight along X, in world units. Floored to
0.0001 when set and at build time. Setting this triggers an immediate mesh rebuild.
Declaration
public float Width { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Methods
Build(Mesh, int, float, float, float, bool, StairsColoringMode, IFaceColorResolver)
Populates target with a parametric straight-stairs mesh. Existing
mesh data is overwritten. stepCount is clamped to [1, 128].
Declaration
public static void Build(Mesh target, int stepCount, float stepHeight, float stepDepth, float width, bool buildSides, StairsColoringMode coloringMode = StairsColoringMode.TreadsAndStructure, IFaceColorResolver resolver = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Mesh | target | Destination mesh. Must be non-null. |
| int | stepCount | Number of steps. Clamped to |
| float | stepHeight | Rise of each step along Y. |
| float | stepDepth | Depth of each tread along Z. |
| float | width | Width of the flight along X. |
| bool | buildSides | When |
| StairsColoringMode | coloringMode | Selects how the resolver indices are assigned. TreadsAndStructure
(the default) uses two indices total - |
| IFaceColorResolver | resolver | Optional per-face color resolver. When non-null, a per-vertex color channel is emitted with one solid color per logical face. When null, no color channel is written. |
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. |