Class ScyllaTriangularPrismShape
Parametric triangular prism shape: two equilateral-triangle end caps connected by three rectangular side quads, centered on the origin with its length along the Y axis. All faces use hard normals (unique vertices per face) for crisp edges.
Inheritance
Inherited Members
Namespace: Scylla.Core.Util.Geom
Assembly: ScyllaCore.dll
Syntax
[AddComponentMenu("Scylla/Geometry/Triangular Prism")]
public sealed class ScyllaTriangularPrismShape : ScyllaShapeBase3D
Remarks
The cross-section is an equilateral triangle whose corners are placed on a circle of
the given circumradius, starting at angle 0 on the XZ plane. The top cap lies at
y = height / 2 and the bottom cap at y = -height / 2.
The mesh has 5 logical faces: top cap (face 0), bottom cap (face 1), and three side quads (faces 2, 3, 4). Total vertex count is 18 (6 cap + 12 side) and total triangle index count is 24.
Per-face coloring (see FaceColoringMode) uses per-region dispatch: face 0 is the top cap, face 1 is the bottom cap, and faces 2 through 4 are the three side quads in order around the perimeter.
The static Build(Mesh, 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
Height
Length of the prism along the Y axis 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 equilateral-triangle cross-section 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, float, float, IFaceColorResolver)
Populates target with a parametric triangular prism mesh.
Existing mesh data is overwritten. The resulting mesh always contains 18 vertices
and 24 triangle indices across 5 logical faces.
Declaration
public static void Build(Mesh target, float radius, float height, IFaceColorResolver resolver = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Mesh | target | Destination mesh. Must be non-null. |
| float | radius | Circumradius of the equilateral-triangle cross-section in local units. Determines the distance from the central Y axis to each corner vertex of the triangular caps. |
| float | height | Length of the prism along the Y axis in local units. The top cap 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. Face
indices are: 0 = top cap, 1 = bottom cap, 2-4 = three side quads in perimeter
order. 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. |