Skip to main content

CliffFill

A class in Root.Township, Alta.Forests.

Forest fill step that places objects up the face of cliffs, using the points from a ForestCliffEvaluator. Runs during static chunk generation, mostly off the main thread.

Constructors​

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

Fields​

13 private and internal fields
MemberWhat it is
private ForestCliffEvaluator cliffEvaluatorSource of cliff points with their position, height, facing and ray length.
private int horizontalStepUses every Nth cliff point.
private float horizontalVariationRandom sideways offset along the cliff.
private bool isBottomAlignedCount rows up from the bottom instead of down from the top.
private LayerMask layerMaskLayers the cliff raycasts hit.
private static Logger loggerLogger for this class.
private float maximumHeightHighest point on a cliff that gets objects, in metres.
private float maximumHeightRatioHighest point as a fraction of the cliff's height.
private float minimumHeightLowest point on a cliff that gets objects, in metres.
private float minimumHeightRatioLowest point as a fraction of the cliff's height.
private float verticalCutChanceChance each row is skipped.
private float verticalSpacingMetres between rows up the cliff.
private float verticalVariationRandom up and down offset per row.

Methods​

MemberWhat it is
protected override async Task GenerateInternal(LocationChunk chunk, InstructionSet instructions)For each cliff point in the chunk, picks heights up the cliff, raycasts into the face on the main thread and adds spawn instructions for hits that pass the fill's modifiers.
protected virtual IEnumerable Raycasts(Vector3 direction, float distance, CliffFill.RaycastRequest[] raycastRequests, int pointCount, PointNormal[] pointNormals) (iterator)Main-thread job: casts each request into the cliff along its direction and records the hit point and normal.