Skip to main content

GameObjectDisplay

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

Cave chunk display that places objects (networked prefabs or static pieces) at non-zero cells of its layer, with hashed offset, rotation and scale, optional floor height and raycast.

Constructors​

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

Fields​

19 private and internal fields
MemberWhat it is
private MapChunkLayer floorThe floor plugin's layer, when isUsingFloorLayer is set.
private float floorThresholdFloor layer value below which a cell counts as open, used to find the floor height.
private bool isOrientedWithFaceIf set, objects are rotated to the surface normal found by the raycast.
private bool isOrientedWithFaceUpForcedWith face orientation, skips the extra 90 degree tilt.
private bool isRacastDownRaycast down if set, otherwise up.
private bool isRaycastedIf set, raycasts to find the surface and drops the spawn if nothing is hit.
private bool isRotationRandomIf set, uses a fully random rotation instead of a random Y rotation.
private bool isScaleUniformIf set, the random scale variation is the same on all axes.
private bool isUsingFloorLayerIf set, lifts the spawn to the floor height read from the floor plugin's layer.
private float maxScaleScale at a cell value of 1; ignored for networked prefabs.
private float minScaleScale at a cell value of 0; ignored for networked prefabs.
private float offsetHeight offset added to the spawn position (and above the raycast hit).
private float offsetXZDeclared but not read in this file; the random XZ offset uses a fixed radius of up to 1.
private float orientationWeightBlend between a random Y rotation (0) and the surface orientation (1).
private float rayCastDistanceMaximum raycast length.
private LayerMask raycastMaskLayers the raycast can hit.
private float scaleVariationRandom scale change, as a fraction up or down.
private float yNormalMaximumHighest allowed Y of the hit normal.
private float yNormalMinimumLowest allowed Y of the hit normal.

Methods​

MemberWhat it is
override void Initialize()Does nothing.
protected override IEnumerator RenderInternal() (iterator)Gets the floor layer if used, then spawns at every non-zero cell.
protected override void Spawn(int seed, int spawnSeed, int spawnIndex, int x, int z, float value, ref int index)Works out position, rotation and scale for one cell (floor, raycast and slope checks included) and spawns the object.