Example #1
0
        private void AlignToTerrain(Transform toAlign, float distanceFromTerrain = 0)
        {
            var terrainHit = TerrainCaster.TerrainCast(toAlign.position, CoastlineTerrain);

            toAlign.rotation = Quaternion.FromToRotation(Vector3.up, terrainHit.normal);
            toAlign.position = terrainHit.point + terrainHit.normal * distanceFromTerrain;
        }
Example #2
0
        public void PlantFakeTree(ZoneProfile zoneProfile, GameObject tree, Spacey.IWorldly treePoint, float treeScale)
        {
            var treeRandomizedRotation = Quaternion.AngleAxis(Random.Range(0, 360), Vector3.up);
            var treeRot      = TerrainCaster.SampleRotation(treePoint, CoastlineTerrain) * treeRandomizedRotation;
            var treeInstance = Instantiate(tree, treePoint.Worldly, treeRot, GetZoneTreeHolder(zoneProfile));

            treeInstance.transform.localScale = Vector3.one * treeScale;
        }
Example #3
0
 private void ResetTerrainHit()
 {
     this._terrainHit = new Lazy <RaycastHit>(() => TerrainCaster.TerrainCast(Worldly, WorldTerrain));
 }