Class ScyllaOctahedronShape
Parametric octahedron shape: 8 equilateral-triangle faces meeting at 6 canonical
axis-aligned vertices (+Y, -Y, +X, -X, +Z,
-Z), all at the given radius from the center. Each face is geometrically
independent so normals are flat per face (hard shading).
Inherited Members
Namespace: Scylla.Core.Util.Geom
Assembly: ScyllaCore.dll
Syntax
[AddComponentMenu("Scylla/Geometry/Octahedron")]
public sealed class ScyllaOctahedronShape : ScyllaShapeBase3D
Remarks
The mesh always has exactly 24 vertices (8 faces x 3 vertices each) and 24 triangle indices. Vertices are not shared across faces so each triangle carries its own normal.
Face winding order (front-face outward):
- Top-front-right (+Y, +Z, +X)
- Top-right-back (+Y, +X, -Z)
- Top-back-left (+Y, -Z, -X)
- Top-left-front (+Y, -X, +Z)
- Bottom-right-front (-Y, +X, +Z)
- Bottom-back-right (-Y, -Z, +X)
- Bottom-left-back (-Y, -X, -Z)
- Bottom-front-left (-Y, +Z, -X)
Per-face coloring (see FaceColoringMode) uses per-region dispatch: all 8 faces are addressable with indices 0 through 7 in the order listed above.
The static Build(Mesh, float, IFaceColorResolver) method can be called directly to populate any UnityEngine.Mesh without attaching a component, which is useful for procedural mesh pipelines.
Properties
Radius
Distance from the center to each axis-aligned vertex, in local units. Uniformly
scales the octahedron. 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 Radius { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Methods
Build(Mesh, float, IFaceColorResolver)
Populates target with a parametric octahedron mesh. Existing
mesh data is overwritten. The resulting mesh always contains exactly 24 vertices
and 24 triangle indices (8 faces x 3 vertices each, no shared vertices).
Declaration
public static void Build(Mesh target, float radius, IFaceColorResolver resolver = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Mesh | target | Destination mesh. Must be non-null. |
| float | radius | Distance from the origin to each of the six axis-aligned vertices, in local units.
Clamped to a minimum of |
| 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 triangular face
(8 faces total, indices 0 through 7 in the winding order documented on
ScyllaOctahedronShape), so each facet can take a distinct palette
color. 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. |