Skip to main content

ClusterSettings

A class in Root.Township, Alta.Caves.Displays.

How a cluster generator scatters child objects (such as crystals or mushrooms) around a point in a cave: how many, how they are rotated, offset and scaled, and whether they snap down onto a surface.

Constructors​

MemberWhat it is
ClusterSettings()Creates a ClusterSettings with default values.

Fields​

15 private and internal fields
MemberWhat it is
private AnimationCurve childCountCurve sampled at a random 0 to 1 value to pick how many children a cluster gets.
private bool isEveningRandomPositionPushes random offsets outwards (square root of each axis) for a more even spread.
private bool isKinematicMakes each child's rigidbody kinematic after placing it.
private bool isOffsetRestrictedToUpwardsKeeps the random vertical offset positive (true by default).
private bool isRaycastingFinalRaycasts down from the placed point and snaps the child to what it hits.
private bool isRotationUnsplitTrue for a fully random rotation. False for random spin plus an up tilt between the min and max.
private bool isScaleRandomScales each child by randomScale sampled at a random value.
private float maximumUpRotationLargest tilt in degrees when isRotationUnsplit is off.
private float maxRaycastDistanceLongest raycast used to snap children (2 by default).
private float minimumUpRotationSmallest tilt in degrees when isRotationUnsplit is off.
private float offsetRadius of the random offset around the parent (0.1 by default).
private AnimationCurve randomScaleCurve giving child scale when isScaleRandom is on.
private LayerMask raycastingLayersLayers the snap raycast hits.
private float verticalOffsetFixed height added to every child's position.
private float verticalOffsetMultiplierScales the random vertical offset. A negative value places children on a flat disc instead of in a sphere.

Properties​

MemberWhat it is
AnimationCurve ChildCount { get; }Curve sampled at a random 0 to 1 value to get how many children to spawn.
bool IsEveningRandomPosition { get; }Pushes random offsets outward (square root of each axis), so children spread more evenly instead of bunching at the centre.
bool IsOffsetRestrictedToUpwards { get; }Keeps the vertical offset positive, so children never sit below the centre.
bool IsRaycastingFinal { get; }Raycasts each child down onto RaycastingLayers after offsetting it, so it sits on a surface.
bool IsRotationUnsplit { get; }True gives each child a fully random rotation. False tilts it between MinimumUpRotation and MaximumUpRotation with random spins.
bool IsScaleRandom { get; }Scales each child by RandomScale sampled at a random value.
float MaximumUpRotation { get; }Largest tilt in degrees when IsRotationUnsplit is false.
float MaxRaycastDistance { get; }How far the surface snap raycast reaches.
float MinimumUpRotation { get; }Smallest tilt in degrees when IsRotationUnsplit is false.
float Offset { get; }Radius of the random position offset around the parent.
AnimationCurve RandomScale { get; }Scale curve used when IsScaleRandom is on.
LayerMask RaycastingLayers { get; }Layers the surface snap raycast hits.
float VerticalOffset { get; }Added to the child's local height after the random offset.
float VerticalOffsetMultiplier { get; }Scales the random vertical offset. Negative values make the offset flat (a circle instead of a sphere).

Methods​

MemberWhat it is
void Position(Transform child, Transform parent)Parents the child and gives it a random rotation, position and scale using these settings.

Used in​

Members of other types that take, return or hold a ClusterSettings: