Class ScyllaPyramidShape
Parametric pyramid shape with a regular N-sided polygon base and a single apex vertex, centered on the origin along the Y axis. Side faces are independent flat triangles with hard per-face normals; the base is tessellated as a triangle fan with a uniform downward normal.
Inherited Members
Namespace: Scylla.Core.Util.Geom
Assembly: ScyllaCore.dll
Syntax
[AddComponentMenu("Scylla/Geometry/Pyramid")]
public sealed class ScyllaPyramidShape : ScyllaShapeBase3D
Remarks
The apex sits at (0, height / 2, 0) and the base polygon lies at
y = -height / 2. Base vertices are distributed evenly around a circle of
the given circumradius, starting at angle 0 on the XZ plane.
Because each side face duplicates its three vertices, seam edges between adjacent
side faces are hard-edged. The base cap uses a triangle-fan decomposition, so it
produces baseSides - 2 triangles.
Per-face coloring (see FaceColoringMode) uses
per-region dispatch: side faces occupy indices 0 through
baseSides - 1, and base fan triangles follow at indices
baseSides through baseSides + (baseSides - 3).
The static Build(Mesh, int, float, float, IFaceColorResolver) method can be called directly to populate any UnityEngine.Mesh without attaching a component, which is useful for procedural mesh pipelines.
Properties
BaseSides
Number of sides on the base polygon. Clamped to [3, 256] at build time.
Setting this property triggers an immediate mesh rebuild via
Rebuild().
Declaration
public int BaseSides { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Height
Total height of the pyramid in local units. Setting this property triggers an immediate mesh rebuild via Rebuild().
Declaration
public float Height { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Radius
Circumradius of the base polygon in local units. Setting this property triggers an immediate mesh rebuild via Rebuild().
Declaration
public float Radius { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Methods
Build(Mesh, int, float, float, IFaceColorResolver)
Populates target with a parametric pyramid mesh. Existing mesh
data is overwritten. Base side count is clamped to [3, 256].
Declaration
public static void Build(Mesh target, int baseSides, float radius, float height, IFaceColorResolver resolver = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Mesh | target | Destination mesh. Must be non-null. |
| int | baseSides | Number of sides on the base polygon. Clamped to |
| float | radius | Circumradius of the base polygon in local units. Determines how wide the base is from center to corner vertex. |
| float | height | Total height of the pyramid in local units. The apex is at |
| IFaceColorResolver | resolver | Optional per-face color resolver. Uses per-region dispatch: when non-null, a
per-vertex color channel is emitted with one solid color per logical face. Side faces
take indices |
Remarks
The side-face UV layout places each side triangle's base edge at v = 0 and
the apex at v = 1; the U coordinate spans the arc fraction of each side.
The base cap UV projects the polygon onto the unit square centered at
(0.5, 0.5) using polar coordinates.
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. |