Class ScyllaConeShape
Parametric cone shape with a circular base and a single apex vertex, centered on the origin along the Y axis. Side faces use hard normals computed per segment triangle; the base cap is a triangle fan with a uniform downward normal.
Inherited Members
Namespace: Scylla.Core.Util.Geom
Assembly: ScyllaCore.dll
Syntax
[AddComponentMenu("Scylla/Geometry/Cone")]
public sealed class ScyllaConeShape : ScyllaShapeBase3D
Remarks
The apex sits at (0, height / 2, 0) and the base circle lies at
y = -height / 2. The number of circumferential segments controls the
resolution of both the side surface and the base cap, and is clamped to
[3, 256] at build time.
Each side triangle is geometrically independent (unique vertex copies) so its
face normal is flat. This gives the cone a low-polygon faceted look at low segment
counts. The base cap shares the Vector3.down normal across all its vertices.
Per-vertex coloring (see FaceColoringMode) uses per-vertex dispatch: the resolver is called once per vertex using the vertex index as face index and the vertex position as face center. This produces smooth spatial gradients under GradientByY and per-vertex speckle under Cycle or Hash.
The static Build(Mesh, float, float, int, IFaceColorResolver) method can be called directly to populate any UnityEngine.Mesh without attaching a component, which is useful for procedural mesh pipelines.
Properties
Height
Total height of the cone in local units. 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 Height { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Radius
Radius of the circular base in local units. 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 |
Segments
Number of circumferential subdivisions around the base circle. Clamped to
[3, 256] when set and at build time. Setting this property triggers an immediate mesh
rebuild via Rebuild().
Declaration
public int Segments { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
Build(Mesh, float, float, int, IFaceColorResolver)
Populates target with a parametric cone mesh. Existing mesh data
is overwritten. Segment count is clamped to [3, 256].
Declaration
public static void Build(Mesh target, float radius, float height, int segments, IFaceColorResolver resolver = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Mesh | target | Destination mesh. Must be non-null. |
| float | radius | Radius of the circular base in local units. Determines the width at |
| float | height | Total height of the cone in local units. The apex is at |
| int | segments | Number of circumferential subdivisions of the base circle. Clamped to |
| IFaceColorResolver | resolver | Optional per-vertex color resolver. Uses per-vertex dispatch: when non-null, a
per-vertex color channel is emitted where the resolver is called once per vertex
with the vertex index as face index and the vertex local position as face center.
This yields smooth spatial gradients under GradientByY
and per-vertex speckle under Cycle or
Hash. 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. |