Skip to main content

RadialPopulationArea

A class in Root.Township, Alta.Populations.

Point evaluator that finds a ground point by raycasting down at a random spot within a radius of its transform.

Constructors​

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

Fields​

6 private and internal fields
MemberWhat it is
private Vector3 cachedPositionThe transform position read at the start of GetPoint.
private List<Vector2> existingOffsets picked so far, used for the minimum distance check. Never cleared.
private int iterationAttemptsHow many spots to try before giving up.
private float minimumDistanceFromExistingMinimum distance from earlier picks. Zero or less turns the check off.
private float radiusSearch radius in metres. Picks cluster toward the centre.
private PopulationRaycast raycastTestThe raycast settings used to find the ground.

Methods​

MemberWhat it is
PointNormal? GetPoint()Tries up to iterationAttempts random spots. Returns null at once if a spot is too close to an earlier one.