Skip to main content

GrassEditorHolder

A class in Root.Township, Alta.Environmental.Vegetation.

Editor tool for shaping one grass blade as a spine of points with a width at each.

Constructors​

MemberWhat it is
GrassEditorHolder()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

3 private and internal fields
MemberWhat it is
private bool proceduralyGeneratedTrue when the spine came from ReceiveProceduralBlade; other edits clear it first.
private List<Vector3> spinePointsBacking field for SpinePoints.
private List<float> widthBacking field for Width.

Properties​

MemberWhat it is
float MaxY { get; }Height of the highest spine point.
List<Vector3> SpinePoints { get; }Spine points, from the root up.
int[] Triangles { get; }Always null in this build.
List<float> Width { get; }Blade width at each spine point.

Methods​

MemberWhat it is
void CreateBlade(int numberOfVertices, float width, float height)Adds a straight spine of evenly spaced points up to a height, all with the same width.
void LoadStructure(GrassBladeMesh newMesh)Rebuilds the spine and widths from a saved GrassBladeMesh's vertex pairs.
void PushVertices(int numberOfVertices)Grows or shrinks the spine to a point count, extending upward from the last point.
void ReceiveProceduralBlade(float frontBend, float sideBend, float height, float width, float widthTop)Replaces the spine with a five-point bent blade from front and side bend, height and widths.
3 private and internal methods
MemberWhat it is
private void ClearProcedural()Clears the spine and widths and the procedural flag.
private void OnDestroy()Empty.
private void OnDrawGizmos()Draws the spine and blade outline in green with yellow spheres at points.